From 0345b6833051f5115b3912616a955c72b8bc8eaa Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 30 Oct 2018 17:15:04 +0100 Subject: 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. --- app/models/user.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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. -- cgit v1.2.1