Use authorize instead of enforce for policies

After fully implementing policies in code, the authorize method
can be safely used and its a safeguard against introducing
policies for some API which are not properly defined in the code.

Change-Id: I499f13c34027b217bf1de905f829f36ef919e3b8
This commit is contained in:
Luigi Toscano 2019-03-08 15:26:57 +01:00
parent 193a604839
commit b95503f38f
1 changed files with 2 additions and 2 deletions

View File

@ -39,8 +39,8 @@ def enforce(rule):
@functools.wraps(func)
def handler(*args, **kwargs):
ctx = context.ctx()
ENFORCER.enforce(rule, {}, ctx.to_dict(), do_raise=True,
exc=exceptions.Forbidden)
ENFORCER.authorize(rule, {}, ctx.to_dict(), do_raise=True,
exc=exceptions.Forbidden)
return func(*args, **kwargs)
return handler