Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent scheduling a new rule with a duplicate alias #3029

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/auslib/web/admin/views/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ def _post(self, transaction, changed_by):
ext={"exception": "%s cannot be set to null/empty " "when scheduling insertion of a new rule" % field},
)

alias = what.get("alias", None)
if alias is not None and dbo.rules.getRule(alias):
return problem(400, "Bad Request", "Rule with alias exists.")

if change_type in ["update", "insert"]:
rule_dict, mapping_values, fallback_mapping_values = process_rule_form(what)
what = rule_dict
Expand Down