Skip to content

Commit

Permalink
Merge pull request privacyidea#1809 from privacyidea/1807/pi-manage-c…
Browse files Browse the repository at this point in the history
…reate-policy

Use name from policy definition file
  • Loading branch information
plettich authored Aug 21, 2019
2 parents 0ea0745 + b74a2f7 commit 2a95dbd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pi-manage
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,14 @@ def create(name, scope, action, filename=None):

params = ast.literal_eval(contents)

if params.get("name") and params.get("name") != name:
print("Found name '{0!s}' in file, will use that instead of "
"'{1!s}'.".format(params.get("name"), name))
else:
print("name not defined in file, will use the cli value "
"{0!s}.".format(name))
params["scope"] = name

if params.get("scope") and params.get("scope") != scope:
print("Found scope '{0!s}' in file, will use that instead of "
"'{1!s}'.".format(params.get("scope"), scope))
Expand All @@ -1169,7 +1177,8 @@ def create(name, scope, action, filename=None):
"{0!s}.".format(action))
params["action"] = action

r = set_policy(name, scope=params.get("scope"),
r = set_policy(params.get("name"),
scope=params.get("scope"),
action=params.get("action"),
realm=params.get("realm"),
resolver=params.get("resolver"),
Expand Down

0 comments on commit 2a95dbd

Please sign in to comment.