Skip to content

Commit

Permalink
Merge pull request #171 from stackhpc/upstream/2023.1-2024-07-01
Browse files Browse the repository at this point in the history
Synchronise 2023.1 with upstream
  • Loading branch information
markgoddard authored Jul 2, 2024
2 parents e096698 + 77293ee commit 3ea52d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions magnum/common/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ def add_policy_attributes(target):
return target


def get_enforcer():
# This method is used by oslopolicy CLI scripts in order to generate policy
# files from overrides on disk and defaults in code.
cfg.CONF([], project='magnum')
init()
return _ENFORCER


def check_is_admin(context):
"""Whether or not user is admin according to policy setting.
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ oslo.config.opts =
oslo.config.opts.defaults =
magnum = magnum.common.config:set_config_defaults

oslo.policy.enforcer =
magnum = magnum.common.policy:get_enforcer

oslo.policy.policies =
magnum = magnum.common.policies:list_rules

Expand Down

0 comments on commit 3ea52d9

Please sign in to comment.