Skip to content

Patterns: ability to disable creation of patterns for certain roles/permissions #28895

Open
@tomjn

Description

@tomjn

What problem does this address?

I'm working on a site that has users signing up and creating posts, but they can create insert and update reusable blocks. This allows them to bypass moderation, and modify other users posts via these blocks, etc, etc, it's a major headache

I've been trying to exterminate this feature, but I cannot hide the UI components, I cannot filter them, I can't disable them, remove support, etc

I thought I could remove the caapability from their roles, and it is implied this can be done on the .org dev site, but the wp_block post type reuses the post capabilities so I cannot target non-admin users.

I can find no official method for removing this feature, be it totally or conditionally.

The closest I have found so far is to use wp.data.dispatch('core/block-editor').updateSettings( { __experimentalReusableBlocks: [] } ) to fool the block editor into thinking there are no reusable blocks at the moment, then deliberately crashing on the save post hook if it matches wp_block.

What is your proposed solution?

Implement capabilities for reusable blocks, and hide UI/UX if the current user does not have the capability to create/view/edit reeusable block posts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] ExtensibilityThe ability to extend blocks or the editing experience[Feature] Synced PatternsRelated to synced patterns (formerly reusable blocks)[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    • Status

      Needs discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions