Commit 9b83acfd authored by Yorick Peterse's avatar Yorick Peterse

Move LDAP sync time constant to a method

This moves the `1.hour` constant used as the LDAP sync time to a
separate method. This allows EE to override this method using a module,
instead of directly modifying the source code.
parent d041e4f6
......@@ -959,12 +959,17 @@ class User < ActiveRecord::Base
if !Gitlab.config.ldap.enabled
false
elsif ldap_user?
!last_credential_check_at || (last_credential_check_at + Gitlab.config.ldap['sync_time']) < Time.now
!last_credential_check_at || (last_credential_check_at + ldap_sync_time) < Time.now
else
false
end
end
def ldap_sync_time
# This number resides in this method so it can be redefined in EE.
1.hour
end
def try_obtain_ldap_lease
# After obtaining this lease LDAP checks will be blocked for 600 seconds
# (10 minutes) for this user.
......
......@@ -156,5 +156,10 @@ module EE
def has_current_license?
License.current.present?
end
override :ldap_sync_time
def ldap_sync_time
::Gitlab.config.ldap['sync_time']
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment