Problem/Motivation

We can create many Display Builder config entities, with different config (which islands? where? which island config?): one for contributors, one for administrators, one for devel/debug, ones for some specific use cases...)

However, this mechanism is not complete without a contextualisation of this choice.

Proposed resolution

Create a permission by display builder config entity so it can be attached to roles. Like what is done by "filter" module.

Then, everywhere display builder is available (entity view, overrides, page layout, views...), propose a list of the builders available to the current user, similar to the text format selector in Long Text fields.

It is also the opportunity to:

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Assigned: Unassigned » mogtofu33

Jean's notes:

Have dynamic config available to the instanciation of display builder `stateManager::create()` and to the user using the display builder.
So config should be permission based. Each config have a `use` permission.

Implementation

For each instance associated with entity / page / views we should store a default config, when using `stateManager::create()` with fallback to default.
This value is stored as `entity_config_id` on the storage, it's a default value for this display builder.

Display builder UX

Have a switch of display builder config when on a display builder, only available the one with current user permission and default to the default one set in state storage `entity_config_id`.

mogtofu33’s picture

Component: Main & misc » Main / Misc.
Issue tags: +display_builder-1.0.0-alpha2
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
mogtofu33’s picture

Title: [1.0.0-alpha2] Display Builder availability according to roles or permissions » Display Builder availability according to roles or permissions
pdureau’s picture

Issue summary: View changes
pdureau’s picture

Issue summary: View changes
mogtofu33’s picture

DB config, one global permission 'administer display builders' to create / edit Delete
For each DB config, one usage permission (as filter module):
Use the %name Display builder config

pdureau’s picture

Filter module permissions, for information:

administer filters:
  title: 'Administer text formats and filters'
  description: 'Define how text is handled by combining filters into text formats.'
  restrict access: true

permission_callbacks:
  - Drupal\filter\FilterPermissions::permissions
pdureau’s picture

pdureau’s picture

Issue summary: View changes
pdureau’s picture

Issue summary: View changes
pdureau’s picture

Assigned: Unassigned » pdureau

I start it, as a follow-up of #3534335: Align config storage properties.

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Active » Needs review

What do you think about the logic in ConfigFormTrait::buildConfigForm()

    return match (count($options)) {
      0 => [
        '#type' => 'html_tag',
        '#tag' => 'p',
        '#value' => t('You are not allowed to use Display Builder.'),
      ],
      1 => [
        '#type' => 'hidden',
        '#default_value' => array_keys($options)[0],
      ],
      default => [
        '#type' => 'select',
        '#title' => $this->t('Display builder config'),
        '#options' => $options,
        '#default_value' => $display_builder,
      ]
    };

It was not discussed.

mogtofu33’s picture

pdureau’s picture

Jean & Pierre's proposal:

    return match (count($options)) {
      0 => [],
      1 => [
        '#type' => 'hidden',
        '#default_value' => array_keys($options)[0],
      ],
      default => [
        '#type' => 'select',
        '#title' => $this->t('Display builder config'),
        '#options' => $options,
        '#default_value' => $display_builder,
      ]
    };
pdureau’s picture

Assigned: mogtofu33 » pdureau
Status: Needs review » Needs work

I will do the change

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs work » Needs review
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs review » Fixed

  • mogtofu33 committed 9bf19497 on 1.0.x authored by pdureau
    Issue #3529129 by pdureau, mogtofu33: Availability according to roles or...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.