Sha256: c6eb648e6949ad63be76e74e2ccbe68f6775233b03f706c4a3b44ab94f5a8e51
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
# encoding: UTF-8 # # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. require_relative 'base_action' module GoodData module LCM2 class EnsureTechnicalUsersDomain < BaseAction DESCRIPTION = 'Ensure Technical Users in Domain' PARAMS = define_params(self) do description 'Client Used for Connecting to GD' param :gdc_gd_client, instance_of(Type::GdClientType), required: true description 'Organization Name' param :organization, instance_of(Type::StringType), required: true end RESULT_HEADER = [ :login, :email, :domain, :status ] class << self def call(params) # Check if all required parameters were passed BaseAction.check_params(PARAMS, params) client = params.gdc_gd_client domain_name = params.organization || params.domain domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}") technical_users = params.technical_user || [] technical_users.map do |technical_user| domain_user = domain.users.find do |du| du.login == technical_user end if domain_user { login: domain_user.login, email: domain_user.email, domain: domain_name, status: 'exists' } else user = domain.add_user(login: technical_user, email: technical_user) { login: user.login, email: user.email, domain: domain_name, status: 'added' } end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gooddata-0.6.51 | lib/gooddata/lcm/actions/ensure_technical_users_domain.rb |
gooddata-0.6.50 | lib/gooddata/lcm/actions/ensure_technical_users_domain.rb |