diff options
Diffstat (limited to 'nova/policy.py')
-rw-r--r-- | nova/policy.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/policy.py b/nova/policy.py index 27e261eac..ac2f2e730 100644 --- a/nova/policy.py +++ b/nova/policy.py @@ -101,14 +101,15 @@ def enforce(context, action, target, do_raise=True): return policy.check(action, target, credentials, **extra) -def check_is_admin(roles): +def check_is_admin(context): """Whether or not roles contains 'admin' role according to policy setting. """ init() - target = {} - credentials = {'roles': roles} + #the target is user-self + credentials = context.to_dict() + target = credentials return policy.check('context_is_admin', target, credentials) |