Merge "Add log statements for policy check failures"
This commit is contained in:
@@ -370,13 +370,16 @@ def enforce(context, action, target, plugin=None):
|
|||||||
:param plugin: currently unused and deprecated.
|
:param plugin: currently unused and deprecated.
|
||||||
Kept for backward compatibility.
|
Kept for backward compatibility.
|
||||||
|
|
||||||
:raises neutron.exceptions.PolicyNotAllowed: if verification fails.
|
:raises neutron.exceptions.PolicyNotAuthorized: if verification fails.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
init()
|
init()
|
||||||
rule, target, credentials = _prepare_check(context, action, target)
|
rule, target, credentials = _prepare_check(context, action, target)
|
||||||
return policy.check(rule, target, credentials,
|
result = policy.check(rule, target, credentials, action=action)
|
||||||
exc=exceptions.PolicyNotAuthorized, action=action)
|
if not result:
|
||||||
|
LOG.debug(_("Failed policy check for '%s'"), action)
|
||||||
|
raise exceptions.PolicyNotAuthorized(action=action)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def check_is_admin(context):
|
def check_is_admin(context):
|
||||||
|
|||||||
Reference in New Issue
Block a user