1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[openstack|identity] Correction in Roles#all method

User#roles should be calling Service#list_roles_for_user_on_tenant
directly and not use Roles#all since the latter is actually a method
for getting all roles in the Identity Service
This commit is contained in:
Mark Maglana 2012-04-17 20:31:47 +08:00 committed by Nelvin Driz
parent f334670a75
commit 0d9b04b104
2 changed files with 3 additions and 14 deletions

View file

@ -7,13 +7,8 @@ module Fog
class Roles < Fog::Collection
model Fog::Identity::OpenStack::Role
attribute :user
attribute :tenant
def all
requires :user, :tenant
load(connection.
list_roles_for_user_on_tenant(tenant.id, user.id).body['roles'])
load(connection.list_roles.body['roles'])
end
def get(id)

View file

@ -54,14 +54,8 @@ module Fog
true
end
def roles
return Array.new unless tenant_id
tenant = Fog::Identity::OpenStack::Tenant.
new(connection.get_tenant(tenant_id).body['tenant'])
connection.roles(
:tenant => tenant,
:user => self)
def roles(tenant_id = self.tenant_id)
connection.list_roles_for_user_on_tenant(tenant_id, self.id).body['roles']
end
end # class User
end # class OpenStack