Merge "Expose a get_enforcer method for oslo.policy scripts"
This commit is contained in:
commit
51956a4f54
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue