Open gsnider2195 opened 1 month ago
Good thought, though also I'd really like to enhance the nav menu API in core at some point so that the common case can implicitly derive the correct permissions without needing so much duplication of information.
Let's not go down the depth of trying to introspect the router. Instead, let's just duck-type the link and permissions to ensure they follow the conventions (modelname_action
and permission_modelname
) and the model names are the same in both. Providing a helpful pylint documentation for this rule would suggest that Model-less views can be safely ignored with the pylint ignore comment.
Environment
Proposed Functionality
Ensure that if permissions are used in NavMenu items that they match the model being used in the linked view. For example, if you are adding a navigation menu item to the
plugins:example_app:examplemodel_list
view, the permission should be forexample_app.view_examplemodel
. See theNavigation Menu
docs for more information.Use Case