Method: GoodData::LCM2::EnsureTechnicalUsersProject.call

Defined in:
lib/gooddata/lcm/actions/ensure_technical_users_project.rb

.call(params) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/gooddata/lcm/actions/ensure_technical_users_project.rb', line 43

def call(params)
  client = params.gdc_gd_client

  technical_users = params.technical_users || params.technical_user || []
  new_users = technical_users.map do |technical_user|
    {
      login: technical_user,
      role: 'admin'
    }
  end

  results = params.synchronize.pmap do |synchronize_info|
    synchronize_info[:to].pmap do |entry|
      ensure_users(client, entry[:pid], new_users)
    end
  end.flatten

  results += params.clients.pmap { |input_client| input_client[:project] }.compact.pmap { |pid| ensure_users(client, pid, new_users) }.flatten if params.clients

  results
end