Commit 8a92a1bb authored by Marin Jankovski's avatar Marin Jankovski

Create sidetiq ldap sync worker.

parent 80640413
class LdapSyncWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
if Gitlab.config.ldap.enabled
HOUR = Gitlab.config.ldap.servers.values.first['schedule_sync_hour']
MINUTE = Gitlab.config.ldap.servers.values.first['schedule_sync_minute']
recurrence { daily.hour_of_day(HOUR).minute_of_hour(MINUTE) }
end
def perform
Rails.logger.info "Performing daily LDAP sync task."
User.ldap.find_each(batch_size: 100).each do |ldap_user|
Rails.logger.debug "Syncing user #{ldap_user.username}, #{ldap_user.email}"
Gitlab::LDAP::Access.allowed?(ldap_user)
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