Sha256: 3fadaa9de964afa16426e41bbe12af7468037c4ae8ad9bc8b0de86d3f41a0d91

Contents?: true

Size: 915 Bytes

Versions: 10

Compression:

Stored size: 915 Bytes

Contents

# encoding: UTF-8

require_relative '../core/core'

module GoodData
  module Command
    class Role
      class << self
        def list(_pid, opts = { :client => GoodData.connection, :project => GoodData.project })
          p = opts[:project]
          fail ArgumentError, 'No :project specified' if p.nil?

          project = GoodData::Project[p, opts]
          fail ArgumentError, 'Wrong :project specified' if project.nil?

          roles_response = client.get("/gdc/projects/#{project.pid}/roles")

          roles = {}
          roles_response['projectRoles']['roles'].each do |role_uri|
            r = client.get(role_uri)
            identifier = r['projectRole']['meta']['identifier']
            roles[identifier] = {
              :user_uri => r['projectRole']['links']['roleUsers'],
              :uri => role_uri
            }
          end
          roles
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gooddata-0.6.20 lib/gooddata/commands/role.rb
gooddata-0.6.19 lib/gooddata/commands/role.rb
gooddata-0.6.18 lib/gooddata/commands/role.rb
gooddata-0.6.17 lib/gooddata/commands/role.rb
gooddata-0.6.16 lib/gooddata/commands/role.rb
gooddata-0.6.15 lib/gooddata/commands/role.rb
gooddata-0.6.14 lib/gooddata/commands/role.rb
gooddata-0.6.13 lib/gooddata/commands/role.rb
gooddata-0.6.12 lib/gooddata/commands/role.rb
gooddata-0.6.11 lib/gooddata/commands/role.rb