Do not display scripts in the scripts list view if the user does not have permission to view them #11680

Open
opened 2025-12-29 21:48:33 +01:00 by adam · 2 comments
Owner

Originally created by @atownson on GitHub (Oct 3, 2025).

Originally assigned to: @bctiemann on GitHub.

NetBox version

v4.4.2

Feature type

New functionality

Proposed functionality

Currently, if you add a permission constraint to the Script model limiting the scripts a user can view, the script is still displayed in the list view and returns a 404 when the hyperlink is clicked. I'm proposing to add a permissions check when rendering the scripts list view that will only display the scripts a user has permission to view. This should be able to be accomplished by adding a permissions check in the script_list_content.html template.

Example Script model permission constraint:

{
  "name__in": [
    "MyScript",
    "YourScript"
  ]
}

Use case

Limiting the scripts in the list view based on permissions would improve the use experience by consolidating the scripts within the list and preventing 404 responses when the hyperlinks are clicked.

Database changes

None

External dependencies

None

Originally created by @atownson on GitHub (Oct 3, 2025). Originally assigned to: @bctiemann on GitHub. ### NetBox version v4.4.2 ### Feature type New functionality ### Proposed functionality Currently, if you add a permission constraint to the `Script` model limiting the scripts a user can view, the script is still displayed in the list view and returns a 404 when the hyperlink is clicked. I'm proposing to add a permissions check when rendering the scripts list view that will only display the scripts a user has permission to view. This should be able to be accomplished by adding a permissions check in the [script_list_content.html](https://github.com/netbox-community/netbox/blob/main/netbox/templates/extras/inc/script_list_content.html) template. Example `Script` model permission constraint: ``` { "name__in": [ "MyScript", "YourScript" ] } ``` ### Use case Limiting the scripts in the list view based on permissions would improve the use experience by consolidating the scripts within the list and preventing 404 responses when the hyperlinks are clicked. ### Database changes None ### External dependencies None
adam added the type: bugstatus: acceptednetboxseverity: low labels 2025-12-29 21:48:33 +01:00
Author
Owner

@atownson commented on GitHub (Oct 3, 2025):

Another note: The permissions check in the ScriptListView class is scoped to ScriptModule instead of Script. This works as expected to limit the modules rendered in the script list view (i.e. if you add a permissions constraint to the ManagedFile model, the constraint is enforced and the module is not rendered in the list view). This issue proposes to add a second permissions check for each script.

@atownson commented on GitHub (Oct 3, 2025): Another note: The permissions check in the `ScriptListView` class is scoped to `ScriptModule` instead of `Script`. This works as expected to limit the modules rendered in the script list view (i.e. if you add a permissions constraint to the `ManagedFile` model, the constraint is enforced and the module is not rendered in the list view). This issue proposes to add a second permissions check for each script.
Author
Owner

@jnovinger commented on GitHub (Nov 3, 2025):

I've gone back and forth on this a few times and ultimately I think this is actually a bug.

@jnovinger commented on GitHub (Nov 3, 2025): I've gone back and forth on this a few times and ultimately I think this is actually a bug.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11680