-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoMethodError (undefined method `find'...) when user logs in #3
Comments
Hi @evle-zzz,
|
Hi, @tainewoo. Unfortunatally I can't upgrade my rails and ruby yet, it's what come with Debian 10.
Also when I try to run redmine:plugins:ldap_sync:sync_users task it updates several users and then fails with this:
Unfortionally I'm not familiar enough with redmine internals to figure out the next step. |
Hi evle-zzz, Let me have a check. line 24-44 |
sed '24,44 !d' plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb
def get_user_fields(username, user_data=nil, options={})
fields_to_sync = setting.user_fields_to_sync
if options.try(:fetch, :include_required, false)
custom_fields = user_required_custom_fields.map {|cf| cf.id.to_s }
fields_to_sync -= (User::STANDARD_FIELDS + custom_fields)
fields_to_sync += (User::STANDARD_FIELDS + custom_fields)
end
ldap_attrs_to_sync = setting.user_ldap_attrs_to_sync(fields_to_sync)
user_data ||= with_ldap_connection do |ldap|
find_user(ldap, username, ldap_attrs_to_sync)
end
return {} if user_data.nil?
user_fields = user_data.inject({}) do |fields, (attr, value)|
f = setting.user_field(attr)
if f && fields_to_sync.include?(f)
fields[f] = value.first unless value.nil? || value.first.blank?
end
fields
end root@redmine2:/var/data/redmine# sed '373,391 !d' plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb
def with_ldap_connection(login = nil, password = nil)
thread = Thread.current
return yield thread[:local_ldap_con] if thread[:local_ldap_con].present?
ldap_con = if setting.account && setting.account.include?('$login')
initialize_ldap_con(setting.account.sub('$login', Net::LDAP::DN.escape(login)), password)
else
initialize_ldap_con(setting.account, setting.account_password)
end
ldap_con.open do |ldap|
begin
yield thread[:local_ldap_con] = ldap
ensure
thread[:local_ldap_con] = nil
end
end
end |
Seems I faced the same issue. The following is the detail redmine information. Environment: I opened log level to debug, and the log is as below: Started GET "/admin/ldap_sync/base_settings.js" for 127.0.0.1 at 2020-01-21 13:27:12 +0000 NoMethodError (undefined method `fetch' for nil:NilClass): plugins/redmine_ldap_sync/app/controllers/ldap_settings_controller.rb:83:in |
I have a same issue... |
Hi all, sorry for late response due to lots of problems these months. Please check your LDAP settings: Administration - LDAP Authentication |
@tainewoo For me it's not the case. Account is set correct, tests on check page are passed and some users are synced by redmine:plugins:ldap_sync:sync_users before it fails. |
Hi @evle-zzz , can you help confirm if the required fields have particular value from your ldap server? |
I got the same Issue. Same behavior as @evle-zzz. Ldap sync start to load some Users and then stops with the said error message. |
Annoyingly I still didn't get this error fixed. I have some guesses but for now that's all. No time to learn ruby to debug this properly. :-( |
I have the exact same issue as @evle-zzz after updating from Redmine 3.3.9 to 4.0.7 on Ruby 2.3.8. Update migrations were successful and before upgrading Redmine to 4.0.7 and the ldap_sync plugin to this fork everything was working fine. |
Switching back to the parent repository and do the following changes worked out well for me: Environment: |
Also got this issue and started to debug. I found that things changed a bit in Rails 5 and created a PR to solve it: Regards |
Getting following error when user logs in. If user was already logged in before plugin is installed everything works fine.
The text was updated successfully, but these errors were encountered: