Use authorize instead of enforce for policy
The authorize function actually checks that the policy we're evaluating has been registered. Since we do use policy-as-code, we can safely use this method which is preferred. Change-Id: I429e56c51f08ad3856f8822479747410c417b9a9
This commit is contained in:
parent
14bfdc49d5
commit
1aaf326e1d
@ -61,8 +61,8 @@ def _do_enforce_rbac(inst, req, action_name, ctx, **kwargs):
|
||||
policy_dict.update(kwargs)
|
||||
# Enforce access controls.
|
||||
if ctx.policy_enforcer:
|
||||
ctx.policy_enforcer.enforce(action_name, flatten(policy_dict),
|
||||
ctx, do_raise=True)
|
||||
ctx.policy_enforcer.authorize(action_name, flatten(policy_dict),
|
||||
ctx, do_raise=True)
|
||||
|
||||
|
||||
def enforce_rbac(action_name='default'):
|
||||
|
@ -33,7 +33,7 @@ from barbican.tests import utils
|
||||
|
||||
def get_barbican_env(external_project_id):
|
||||
class NoopPolicyEnforcer(object):
|
||||
def enforce(self, *args, **kwargs):
|
||||
def authorize(self, *args, **kwargs):
|
||||
return
|
||||
|
||||
kwargs = {'roles': None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user