diff options
author | Jamie Lennox <jamielennox@redhat.com> | 2014-07-04 09:51:04 +1000 |
---|---|---|
committer | Jamie Lennox <jamielennox@redhat.com> | 2014-07-04 14:06:28 +1000 |
commit | dfdb206a664268297a346a4cf899f494f7d236f7 (patch) | |
tree | e6c15ffad048835ab6513f18f25e25ceddc24f72 /keystoneclient/v2_0 | |
parent | 2635c994e0dade40e4d10e4a82de378b6e5b1fd3 (diff) | |
download | python-keystoneclient-dfdb206a664268297a346a4cf899f494f7d236f7.tar.gz |
Pass roles manager to user manager
This is part of breaking a cyclical dependency where the client has a
reference to the manager but the manager has a reference to the client.
To be able to pass in an adapter to the managers we need to remove the
client specific usages of manager, including referring to other managers
via the client.
Change-Id: I8fba7ece05e33d519eb31994a072275598ba76ea
Diffstat (limited to 'keystoneclient/v2_0')
-rw-r--r-- | keystoneclient/v2_0/client.py | 2 | ||||
-rw-r--r-- | keystoneclient/v2_0/users.py | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/keystoneclient/v2_0/client.py b/keystoneclient/v2_0/client.py index 0d4e685..08263a7 100644 --- a/keystoneclient/v2_0/client.py +++ b/keystoneclient/v2_0/client.py @@ -135,7 +135,7 @@ class Client(httpclient.HTTPClient): self.services = services.ServiceManager(self) self.tenants = tenants.TenantManager(self) self.tokens = tokens.TokenManager(self) - self.users = users.UserManager(self) + self.users = users.UserManager(self, self.roles) # extensions self.ec2 = ec2.CredentialsManager(self) diff --git a/keystoneclient/v2_0/users.py b/keystoneclient/v2_0/users.py index 57f036e..fcac0b5 100644 --- a/keystoneclient/v2_0/users.py +++ b/keystoneclient/v2_0/users.py @@ -35,6 +35,10 @@ class UserManager(base.ManagerWithFind): """Manager class for manipulating Keystone users.""" resource_class = User + def __init__(self, client, role_manager): + super(UserManager, self).__init__(client) + self.role_manager = role_manager + def get(self, user): return self._get("/users/%s" % base.getid(user), "user") @@ -122,5 +126,5 @@ class UserManager(base.ManagerWithFind): "users") def list_roles(self, user, tenant=None): - return self.api.roles.roles_for_user(base.getid(user), - base.getid(tenant)) + return self.role_manager.roles_for_user(base.getid(user), + base.getid(tenant)) |