summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2018-10-30 17:15:04 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2018-11-01 14:20:38 +0100
commit0345b6833051f5115b3912616a955c72b8bc8eaa (patch)
tree80e1ca23c56ee56e8b64e374dc6f7ca262764f70
parent8e674510c582c75cab55d80a6253a6c9fb6addc2 (diff)
downloadgitlab-ce-0345b6833051f5115b3912616a955c72b8bc8eaa.tar.gz
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.
-rw-r--r--app/models/user.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index cc2cd1b7723..ad038039ade 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -941,12 +941,17 @@ class User < ActiveRecord::Base
if !Gitlab.config.ldap.enabled
false
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
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.