Merge "Expose a get_enforcer method for oslo.policy scripts"

This commit is contained in:
Zuul 2018-10-18 16:22:59 +00:00 committed by Gerrit Code Review
commit 51956a4f54
2 changed files with 9 additions and 0 deletions

View File

@ -71,6 +71,12 @@ def set_rules(rules, overwrite=True, use_conf=False):
_ENFORCER.set_rules(rules, overwrite, use_conf)
def get_enforcer():
cfg.CONF([], project='congress')
init()
return _ENFORCER
def enforce(context, action, target, do_raise=True, exc=None):
"""Verifies that the action is valid on the target in this context.

View File

@ -44,6 +44,9 @@ oslo.policy.policies =
# the default defined polices.
congress = congress.common.policies:list_rules
oslo.policy.enforcer =
congress = congress.common.policy:get_enforcer
console_scripts =
congress-server = congress.server.congress_server:main
congress-db-manage = congress.db.migration.cli:main