Sha256: 48f51d280a76797fdaa7f5a0044158581f32a1832cda1084058f44aa23ee9acb

Contents?: true

Size: 1016 Bytes

Versions: 25

Compression:

Stored size: 1016 Bytes

Contents

module Fog
  module Identity
    class OpenStack
      class V2
        class Real
          def add_user_to_tenant(tenant_id, user_id, role_id)
            request(
              :expects => 200,
              :method  => 'PUT',
              :path    => "/tenants/#{tenant_id}/users/#{user_id}/roles/OS-KSADM/#{role_id}"
            )
          end
        end

        class Mock
          def add_user_to_tenant(tenant_id, user_id, role_id)
            role = data[:roles][role_id]
            data[:user_tenant_membership][tenant_id] ||= {}
            data[:user_tenant_membership][tenant_id][user_id] ||= []
            data[:user_tenant_membership][tenant_id][user_id].push(role['id']).uniq!

            response = Excon::Response.new
            response.status = 200
            response.body = {
              'role' => {
                'id'   => role['id'],
                'name' => role['name']
              }
            }
            response
          end
        end
      end
    end
  end
end

Version data entries

25 entries across 23 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.10 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.1.30 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.1.29 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.9 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.1.28 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.8 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.7 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.6 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.5 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.4 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.3 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.2 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.3.0 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.2.4 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.2.3 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.2.2 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.2.1 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-openstack-0.2.0 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb
fog-zj-0.1.28 lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb