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:
parent
193a604839
commit
b95503f38f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue