summaryrefslogtreecommitdiffstats
path: root/nova/auth
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-07-22 20:41:46 +0000
committerVishvananda Ishaya <vishvananda@gmail.com>2011-07-22 20:41:46 +0000
commite8defa6bdd5af85486d0d3acce8956670ca16882 (patch)
tree738058c199c1cba0c4b84c38f30363a5ef01121b /nova/auth
parent0f8eee7ff32a91c866742939b1f551f3610f1276 (diff)
fix test_access
Diffstat (limited to 'nova/auth')
-rw-r--r--nova/auth/manager.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/auth/manager.py b/nova/auth/manager.py
index 06af7e781..7f99d9016 100644
--- a/nova/auth/manager.py
+++ b/nova/auth/manager.py
@@ -518,6 +518,15 @@ class AuthManager(object):
return drv.get_user_roles(User.safe_id(user),
Project.safe_id(project))
+ def get_active_roles(self, user, project=None):
+ """Get all active roles for context"""
+ if project:
+ roles = FLAGS.allowed_roles
+ roles.append('projectmanager')
+ else:
+ roles = FLAGS.global_roles
+ return [role for role in roles if self.has_role(user, role, project)]
+
def get_project(self, pid):
"""Get project object by id"""
with self.driver() as drv: