Block devices with sub-components from becoming sub-components via forged edit
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user