Sha256: eda302ebdadc569e33cc77c3d55f9f4a9af6e48242fb634b50b9e2208872ae83
Contents?: true
Size: 1.9 KB
Versions: 2
Compression:
Stored size: 1.9 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 description 'Technical users' param :technical_user, array_of(instance_of(Type::StringType)), required: false end RESULT_HEADER = [ :login, :email, :domain, :status ] class << self def call(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 || []).uniq technical_users.pmap 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.53 | lib/gooddata/lcm/actions/ensure_technical_users_domain.rb |
gooddata-0.6.52 | lib/gooddata/lcm/actions/ensure_technical_users_domain.rb |