Skip to content

Commit

Permalink
Add duplicate alias check for scheduled changes for new rule
Browse files Browse the repository at this point in the history
  • Loading branch information
michellemounde committed Oct 24, 2023
1 parent 6d46207 commit 333df81
Showing 1 changed file with 4 additions and 0 deletions.
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

0 comments on commit 333df81

Please sign in to comment.