From 50e5bb9717baebda8bc2c1b2ce132a622f988b79 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Tue, 20 Feb 2024 23:37:13 +0530 Subject: [PATCH] added validation error for script and report constraint #15174 --- netbox/users/forms/model_forms.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/netbox/users/forms/model_forms.py b/netbox/users/forms/model_forms.py index aa5811cd1..058511431 100644 --- a/netbox/users/forms/model_forms.py +++ b/netbox/users/forms/model_forms.py @@ -380,6 +380,12 @@ class ObjectPermissionForm(BootstrapMixin, forms.ModelForm): constraints = [constraints] for ct in object_types: model = ct.model_class() + + if model._meta.model_name in ['script', 'report']: + raise forms.ValidationError({ + 'constraints': _('Constraints are not supported for this object type.') + }) + try: tokens = { CONSTRAINT_TOKEN_USER: 0, # Replace token with a null user ID