diff --git a/netbox/users/constants.py b/netbox/users/constants.py index 982e69868..744ec0f92 100644 --- a/netbox/users/constants.py +++ b/netbox/users/constants.py @@ -10,8 +10,9 @@ OBJECTPERMISSION_OBJECT_TYPES = ( CONSTRAINT_TOKEN_USER = '$user' -# Built-in actions that receive special handling (dedicated checkboxes, model properties) -# and should not be registered as custom model actions. +# Django's four default model permissions. These receive special handling +# (dedicated checkboxes, model properties) and should not be registered +# as custom model actions. RESERVED_ACTIONS = ('view', 'add', 'change', 'delete') # API tokens diff --git a/netbox/utilities/permissions.py b/netbox/utilities/permissions.py index f27531936..49177af9f 100644 --- a/netbox/utilities/permissions.py +++ b/netbox/utilities/permissions.py @@ -53,6 +53,8 @@ def register_model_actions(model: type[Model], actions: list[ModelAction | str]) for action in actions: if isinstance(action, str): action = ModelAction(name=action) + if not action.name: + raise ValueError("Action name must not be empty.") if action.name in RESERVED_ACTIONS: raise ValueError(f"'{action.name}' is a reserved action and cannot be registered.") if action not in registry['model_actions'][label]: