Commit 0345b683 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 8e674510
...@@ -941,12 +941,17 @@ class User < ActiveRecord::Base ...@@ -941,12 +941,17 @@ class User < ActiveRecord::Base
if !Gitlab.config.ldap.enabled if !Gitlab.config.ldap.enabled
false false
elsif ldap_user? elsif ldap_user?
!last_credential_check_at || (last_credential_check_at + 1.hour) < Time.now !last_credential_check_at || (last_credential_check_at + ldap_sync_time) < Time.now
else else
false false
end end
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 def try_obtain_ldap_lease
# After obtaining this lease LDAP checks will be blocked for 600 seconds # After obtaining this lease LDAP checks will be blocked for 600 seconds
# (10 minutes) for this user. # (10 minutes) for this user.
......
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