add refusal reason to log
This commit is contained in:
parent
f55c9e4d25
commit
e8ba56349e
1 changed files with 4 additions and 1 deletions
|
|
@ -9753,7 +9753,10 @@ def check_policy(name, data, default='deny', strict=False, force=False):
|
||||||
reason = 'error in policy'
|
reason = 'error in policy'
|
||||||
logger.error("Invalid action in policy %s, rule: %s", name, lastrule)
|
logger.error("Invalid action in policy %s, rule: %s", name, lastrule)
|
||||||
if force and context.session.assertPerm('admin'):
|
if force and context.session.assertPerm('admin'):
|
||||||
logger.info("Policy %s overriden by force: %s" % (name, context.session.user_data["name"]))
|
msg = "Policy %s overriden by force: %s" % (name, context.session.user_data["name"])
|
||||||
|
if reason:
|
||||||
|
msg += ": %s" % reason
|
||||||
|
logger.info(msg)
|
||||||
return True, "overriden by force"
|
return True, "overriden by force"
|
||||||
if not strict:
|
if not strict:
|
||||||
return False, reason
|
return False, reason
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue