Block devices with sub-components from becoming sub-components via forged edit

This commit is contained in:
2026-06-10 12:29:18 -05:00
parent 2a103f52a5
commit a9835fee1e
2 changed files with 16 additions and 0 deletions
+3
View File
@@ -889,6 +889,9 @@ def create_app(config_object="config"):
if new_parent.id == device_id:
flash("A device cannot be its own parent.", "error")
return redirect(url_for("device_detail", device_id=device_id))
if device.has_children():
flash("A device with sub-components cannot itself become a sub-component.", "error")
return redirect(url_for("device_detail", device_id=device_id))
if new_parent.is_subcomponent():
flash("Cannot nest sub-components more than one level deep.", "error")
return redirect(url_for("device_detail", device_id=device_id))