Class: SynchronizeUsers::Sync
- Inherits:
-
Object
- Object
- SynchronizeUsers::Sync
- Defined in:
- lib/synchronize-users/sync.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Sync
constructor
A new instance of Sync.
- #run! ⇒ Object
Constructor Details
#initialize(config) ⇒ Sync
Returns a new instance of Sync.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/synchronize-users/sync.rb', line 5 def initialize(config) @config = config @target_group = TargetGroup.new(@config.gitlab.groups, @config.to) @from_group = FromGroup.new(@config.ldap.groups, @config.from, @target_group) end |
Instance Method Details
#run! ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/synchronize-users/sync.rb', line 16 def run! @from_group.each_new_user do |user| @target_group.import_user(user, @config.role) do |result| result.on_new_user { |source| @target_group.create_user(source) } result.on_error { |e| logger.error e } end end end |