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

Improve Site Editor UI when user capabilities are restricted #56300

Open
ndiego opened this issue Nov 19, 2023 · 0 comments
Open

Improve Site Editor UI when user capabilities are restricted #56300

ndiego opened this issue Nov 19, 2023 · 0 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. [Type] Enhancement A suggestion for improvement.

Comments

@ndiego
Copy link
Member

ndiego commented Nov 19, 2023

What problem does this address?

In preparing another issue (#56299), I discovered some interesting behavior in the Site Editor when user capabilities are restricted. Consider this example user role:

function create_custom_site_editor_role() {
    $capabilities = array(
        'read' => true,
        'edit_theme_options' => true,  // Allows access to the Site Editor and appearance settings
    );
    add_role( 'site_editor', 'Site Editor', $capabilities );
}
add_action( 'init', 'create_custom_site_editor_role' );

This user role provides access to the Site Editor, but it's extremely restrictive. The user cannot add/modify pages, add/modify patterns, etc.

There are restrictions in place. For example, if I try to add a page, I get the following:

site-editor-capabilities-pages

The Pages sidebar item still exists, but clicking on it does not load any pages. This is expected because the user role cannot access pages, but it's a bit confusing that the "Pages" menu item even exists. Then, when you try to add a page, there is an error message, as expected.

The same is true for templates. While this user role can modify templates, they cannot add them. When trying to do so, I just get a non-descript error message.

site-editor-capabilities-templates

The same is true for patterns/template parts.

What is your proposed solution?

I think we need to hide UI elements when they do not function based on the user's given capabilities. We may even need new capabilities to handle this appropriately.

But at a minimum, the Pages sidebar items should probably be hidden if the user cannot access/create pages. Similarly, the + icons should be hidden if the user cannot add templates, template parts, or patterns.

I am sure there are other things I have missed, but ensuring use capabilities are accurately reflected in the Site Editor will improve the user experience for those who have been given access but have limited permissions. This is going to be important for Site Editor adoption, especially for agencies and those building sites for clients who want a more restricted editing environment for their users.

@ndiego ndiego added [Type] Enhancement A suggestion for improvement. [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. labels Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

1 participant