summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorMichael Gundlach <michael.gundlach@rackspace.com>2010-09-23 17:06:23 -0400
committerMichael Gundlach <michael.gundlach@rackspace.com>2010-09-23 17:06:23 -0400
commita70632890c610ece766bfd3c31eea4bc6eb4a316 (patch)
treeb74a23f101aeba06dd9653494568bdb508174c35 /nova/api
parent4846b63a861ee7eafc642dc93f70fa8b85dfa625 (diff)
downloadnova-a70632890c610ece766bfd3c31eea4bc6eb4a316.tar.gz
nova-a70632890c610ece766bfd3c31eea4bc6eb4a316.tar.xz
nova-a70632890c610ece766bfd3c31eea4bc6eb4a316.zip
Apply vish's patch
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/__init__.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py
index b041787c2..f0aa57ee4 100644
--- a/nova/api/ec2/__init__.py
+++ b/nova/api/ec2/__init__.py
@@ -166,8 +166,8 @@ class Authorizer(wsgi.Middleware):
'ModifyImageAttribute': ['projectmanager', 'sysadmin'],
},
'AdminController': {
- # All actions have the same permission: [] (the default)
- # admins will be allowed to run them
+ # All actions have the same permission: ['none'] (the default)
+ # superusers will be allowed to run them
# all others will get HTTPUnauthorized.
},
}
@@ -177,8 +177,7 @@ class Authorizer(wsgi.Middleware):
context = req.environ['ec2.context']
controller_name = req.environ['ec2.controller'].__class__.__name__
action = req.environ['ec2.action']
- allowed_roles = self.action_roles[controller_name].get(action, [])
- allowed_roles.extend(FLAGS.superuser_roles)
+ allowed_roles = self.action_roles[controller_name].get(action, ['none'])
if self._matches_any_role(context, allowed_roles):
return self.application
else:
@@ -186,6 +185,8 @@ class Authorizer(wsgi.Middleware):
def _matches_any_role(self, context, roles):
"""Return True if any role in roles is allowed in context."""
+ if context.user.is_superuser():
+ return True
if 'all' in roles:
return True
if 'none' in roles: