diff --git a/congress/common/policy.py b/congress/common/policy.py index 1f494714d..df77289b0 100644 --- a/congress/common/policy.py +++ b/congress/common/policy.py @@ -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. diff --git a/setup.cfg b/setup.cfg index 119719d45..3c9deb7cb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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