Support auth_required in PluginMenuItem #10716

Closed
opened 2025-12-29 21:35:08 +01:00 by adam · 0 comments
Owner

Originally created by @bctiemann on GitHub (Jan 29, 2025).

Originally assigned to: @bctiemann on GitHub.

NetBox version

v4.2.2

Feature type

New functionality

Proposed functionality

At present the PluginMenuItem class is missing the auth_required attribute which is present on all regular MenuItems, and which is necessary for controlling whether the plugin's menu items appear in the nav menu. This attribute needs to be defined with a default of False.

Use case

This is necessary because of this code:

5cd7c6d167/netbox/utilities/templatetags/navigation.py (L24-L31)

Which is what determines whether a menu item is shown in the nav menu. Because auth_required is not present on PluginMenuItem, the check on L29 evaluates to False and the menu item is shown regardless of authentication state.

Database changes

N/A

External dependencies

N/A

Originally created by @bctiemann on GitHub (Jan 29, 2025). Originally assigned to: @bctiemann on GitHub. ### NetBox version v4.2.2 ### Feature type New functionality ### Proposed functionality At present the `PluginMenuItem` class is missing the `auth_required` attribute which is present on all regular `MenuItem`s, and which is necessary for controlling whether the plugin's menu items appear in the nav menu. This attribute needs to be defined with a default of `False`. ### Use case This is necessary because of this code: https://github.com/netbox-community/netbox/blob/5cd7c6d167ea3b0a23651823adbcd44c103b63c4/netbox/utilities/templatetags/navigation.py#L24-L31 Which is what determines whether a menu item is shown in the nav menu. Because `auth_required` is not present on `PluginMenuItem`, the check on L29 evaluates to `False` and the menu item is shown regardless of authentication state. ### Database changes N/A ### External dependencies N/A
adam added the status: acceptedtype: featurecomplexity: low labels 2025-12-29 21:35:08 +01:00
adam closed this issue 2025-12-29 21:35:09 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10716