[Bug] Fix to setup policy
setup_policy() method is not working because it is outside of decorator. So the api server always runs with default policy even policy.yaml file exists. Change-Id: I2c70b0444cf838a03fa4e3a0a79cd9e137f153c6
This commit is contained in:
parent
c1ecb54a69
commit
73be096cea
@ -46,17 +46,14 @@ def _enforce_policy(action, target, credentials, do_raise=True):
|
||||
|
||||
|
||||
def enforce(rule):
|
||||
|
||||
setup_policy()
|
||||
|
||||
def decorator(func):
|
||||
@functools.wraps(func)
|
||||
def handler(*args, **kwargs):
|
||||
setup_policy()
|
||||
context = args[1].context
|
||||
_enforce_policy(rule, {}, context, do_raise=True)
|
||||
return func(*args, **kwargs)
|
||||
return handler
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user