[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:
Dae Seong Kim 2018-02-21 22:28:27 -08:00
parent c1ecb54a69
commit 73be096cea
1 changed files with 1 additions and 4 deletions

View File

@ -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