Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specific capability for Navigation permissions #65881

Open
stevencamilleri-g2m opened this issue Oct 4, 2024 · 8 comments
Open

Add specific capability for Navigation permissions #65881

stevencamilleri-g2m opened this issue Oct 4, 2024 · 8 comments
Labels
[Block] Navigation Affects the Navigation Block [Feature] Navigation Menus Any issue relating to Navigation Menus [Type] Enhancement A suggestion for improvement.

Comments

@stevencamilleri-g2m
Copy link

What problem does this address?

When it comes to the Navigation block, currently editor roles are able to add a navigation block within the block editor but are not able to assign any menus as the navigation block returns the message You do not have the permission to edit Navigation menus. The functionality is not available because by default editor roles have edit_theme_options set to false and without that, the navigation block doesn't allow any access to menus. (Ref: Navigation block user permissions)

Image

The only workaround I have currently is to enable edit_theme_options for editor roles so they have the ability to access menus within the Navigation block, however that would then open up full access to theme options and FSE which I wouldn't want for editors.

What is your proposed solution?

I would suggest creating a specific capability for managing navigation menus. This would allow more granular control over what different roles can do, without giving them access to all theme options. It would also allow the navigation block to be fully functional within the block editor without giving the users access to the site editor (FSE).

@colorful-tones colorful-tones added [Type] Enhancement A suggestion for improvement. [Block] Navigation Affects the Navigation Block [Feature] Navigation Menus Any issue relating to Navigation Menus labels Oct 4, 2024
@getdave
Copy link
Contributor

getdave commented Oct 7, 2024

@fabiankaegy I think you were looking at permissions at some point relating to template parts. Is there any overlap here with navigation?

In our case it's not the block that needs granular permissions but the act of being able to manipulate a menu.

@fabiankaegy
Copy link
Member

@getdave I think this goes much more in depth than what I had looked at before. But I do believe this is a very important topic that we should embrace at some point.

Today the entire site editor is an all or nothing experience. But I do believe that especially in larger organizations there are very different sets of responsibilities that all get combined into one here.

Someone that should be able to update the contents of the site header navigation for example shouldn't necessarily also have the capability to change the layout of the site / the global styles.

It would be very nice if we could split the edit-theme-options capability into more granular sub capabilities which then have a direct affect on which areas of the Site Editor a user can access.

@justintadlock
Copy link
Contributor

This has long been an issue. There's an existing Trac ticket: https://core.trac.wordpress.org/ticket/29213

@stevencamilleri-g2m
Copy link
Author

Was there a point where users without edit_theme_options capability were still able to select menus within the navigation block? I'm seeing the screenshot (attached below) in 37454 and I'm unsure if this was a POC or it was actually working that way at some point.

Image

@genepine
Copy link

genepine commented Oct 9, 2024

In block themes, the navigation menu cannot be edited with editor privileges.
In classic themes, we can use the plugin UserRoleEditor or AdminMenu to give editor privileges and above (i.e. general users) the appropriate privileges for customizing the navigation menu, which allows you to change the order of the menu and change the destination of links.
This is not possible with block themes.

@getdave
Copy link
Contributor

getdave commented Oct 10, 2024

We need to make it possible to customise the block based on the standard WordPress permissions system. That would allow those Plugins to work as you describe.

@stevencamilleri-g2m
Copy link
Author

Would it better to create a ticket related to the edit-theme-options capabilities specifically? Particularly related to what @fabiankaegy stated:

It would be very nice if we could split the edit-theme-options capability into more granular sub capabilities which then have a direct affect on which areas of the Site Editor a user can access.

Not sure if there are already any open issues related to this.

@getdave
Copy link
Contributor

getdave commented Nov 4, 2024

I'm wondering if we could do something similar to what was proposed in #58957 whereby we add specific permissions for the Navigation post type and then map these to edit_theme_options. Then by default things would work as they do today but it would allow developers to tap into the standard permissions system to modify the Navigation block behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Feature] Navigation Menus Any issue relating to Navigation Menus [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants