Provide a permission to admin reusable blocks.

Created on 3 June 2022, over 2 years ago
Updated 10 August 2023, about 1 year ago

Problem/Motivation

For some editorial workflows is important to create the reusable blocks as a library of templates/layouts, but to avoid all editors to add any template they want and have an unmanageable list, it is needed that only some higher roles can admin the Reusable blocks.

Steps to reproduce

Just assign to any role the Use Gutenberg permission and every user with access to Gutenberg will also have permissions to create Reusable blocks.

Proposed resolution

  • Create a new permission to allow create, edit and delete reusable blocks.
  • The main Use Gutenberg permission will allow the users to add the existing reusable blocks to the pages.
  • When users without permissions add an existing reusable block, it will be automatically converted to regular block to avoid editing issues and confusion.

User interface changes

  • Users without permission to admin reusable blocks won't see the "Add to reusable" menu item in the block options.
  • Add some notices to let the users know when the reusable blocks where automatically converted to regular.
Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇨🇴Colombia jidrone

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇴Colombia jidrone

    Ideally, users should be able to use reusable blocks, just don't have permissions to edit them.

    This is exactly what this patch is doing, they users without the permission are able to see the "Reusable" tab and add any of the existing reusable blocks, but they are not able to create new ones or edit the existing ones, so it is possible to control who manages reusable blocks.

    And the reason it is being converted to regular block automatically is to improve the UX because as mentioned in the comment #4, it is really common that new Gutenberg users don't know they are editing a reusable block, so they change it accidentally.

  • Status changed to Needs review over 1 year ago
  • 🇨🇴Colombia jidrone

    Rerolled and moved to needs review.

  • 🇨🇦Canada joseph.olstad

    great work @jidrone, it appears you've made numerous improvements, fixes and cleanup here in addition to addressing reusable block challenges.

    We've also come accross this issue as mentioned in comment #4

    I would also appreciate the addition of these permissions so I can prevent editors from using the reusable blocks. There have been inadvertant updates since the editor did not realize it updated the block on all pages.

  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
Production build 0.71.5 2024