From 333df81763c9f133ef41839cc9d2a299ea23288e Mon Sep 17 00:00:00 2001 From: Michelle Mounde Date: Mon, 23 Oct 2023 14:38:55 +0300 Subject: [PATCH] Add duplicate alias check for scheduled changes for new rule --- src/auslib/web/admin/views/rules.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/auslib/web/admin/views/rules.py b/src/auslib/web/admin/views/rules.py index 754cb104f5..2e6be732cd 100644 --- a/src/auslib/web/admin/views/rules.py +++ b/src/auslib/web/admin/views/rules.py @@ -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