Problem/Motivation

If a role has required permissions on views, page layout and display required for Display Builder and:

  • access administration pages
  • view display builder instance

But not the Display builder profiles, which seems like a common use case for a Builder role, then access to /admin/structure/display-builder is denied because the profiles is the main default menu/tab.

Expected

It's expected for the user to have first level access to each Instances types under admin > Structure.

With views permission it's ok, with Page Layout as well, but not Entity instances as they are only listed under /admin/structure/display-builder/instances.

Same for presets if permission administer pattern preset is granted. But mitigated by the fact that preset permissions are perhaps more commonly set in conjunction with profiles permissions.

Proposed resolution

Option 1: Hook

if user has view display builder instance but not Display builder profiles:

  • Add a hook route alter to change permission on route entity.display_builder_profile.collection from administer display builder profile to view display builder instance.
  • Add a hook menu alter to set Instances as route_name for menu entity.display_builder_profile.collection.

Is it enough to have expected result?

Option 2: Routing and menu logic

Separate menu first level and move instances and optionally profiles under /admin/structure.

Remaining tasks

Decide best solution.

User interface changes

Menu and access to admin pages.

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

mogtofu33 created an issue. See original summary.

mogtofu33’s picture

Issue summary: View changes
mogtofu33’s picture

Assigned: Unassigned » pdureau
Status: Active » Needs review
mogtofu33’s picture

Looks like we don't need the route part, only menu alter.

pdureau’s picture

pdureau’s picture

Let's move to beta2 if not merged today.

pdureau’s picture

Let's talk about that in early beta2 phase

pdureau’s picture

pdureau’s picture

Assigned: pdureau » mogtofu33

Hi,

If I understand correctly the proposal:

  • Instance tab and menu links has been moved in between Profile and Presets
  • If the user has view display builder instance permission but not entity.display_builder_instance.collection permission, the menu item targeting /admin/structure/display-builder is opening "Instances" page instead of "Profiles" page.

Tests with an user without the entity.display_builder_instance.collection (I guess, how can I check? Is it really a permission ?) but with Use the administration pages and view display builder instance permissions:

On 1.0.0 branch:

  • /admin/structure: i don't see the "Display builder" menu link
  • /admin/structure/display-builder : Access denied
  • /admin/structure/display-builder/instances: I see the instances

On the issue MR:

  • /admin/structure: i don't see the "Display builder" menu link, ❌ Am I supposed to see as a link to /admin/structure/display-builder/instances ?
  • /admin/structure/display-builder : Access denied, as expected ✅ I guess
  • /admin/structure/display-builder/instances: I see the instances, as expected ✅

Am I understanding and testing right? Are we sure entity.display_builder_instance.collection which is checked in menu_links_discovered_alter hook is a permission? I know about https://www.drupal.org/node/2955178 but I don't see collection_permission in Instance entity attributes.

Also, I understand the proposal when user have no access to Display Builder profiles collection page. It is better to show them the Instances collection than an Access Denied. But what is expected when users can also have access to the Profiles collection page? Do we want to override the link anyway?

mogtofu33’s picture

Status: Needs review » Needs work

This issue is a bit old but let's try to update with the current permissions.
And there is issue with entity operations as well to manage access for.

mogtofu33’s picture

mogtofu33’s picture

pdureau’s picture

mogtofu33’s picture

Status: Needs work » Active
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
pdureau’s picture

Rebased.

The MR is proposing:

  • Reordering of menu links in system.admin_structure:: "Instances / Profile / Preset" instead of "Profile / Preset / Instances"
  • Reordering of local tasks, for the smae routes I guess
  • Alteration of entity.display_builder_profile.collection route

We can ship 1.0.0 without such a change. I remove the beta tag.