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.collectionfromadminister display builder profiletoview display builder instance. - Add a hook menu alter to set Instances as
route_namefor menuentity.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.
Issue fork display_builder-3558459
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
Comment #2
mogtofu33 commentedComment #3
mogtofu33 commentedComment #4
mogtofu33 commentedLooks like we don't need the route part, only menu alter.
Comment #5
pdureau commentedComment #6
pdureau commentedLet's move to beta2 if not merged today.
Comment #7
pdureau commentedLet's talk about that in early beta2 phase
Comment #8
pdureau commentedComment #10
pdureau commentedHi,
If I understand correctly the proposal:
view display builder instancepermission but notentity.display_builder_instance.collectionpermission, the menu item targeting/admin/structure/display-builderis 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 withUse the administration pagesandview display builder instancepermissions:On 1.0.0 branch:
On the issue MR:
Am I understanding and testing right? Are we sure
entity.display_builder_instance.collectionwhich is checked inmenu_links_discovered_alterhook is a permission? I know about https://www.drupal.org/node/2955178 but I don't seecollection_permissionin 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?
Comment #11
mogtofu33 commentedThis 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.
Comment #12
mogtofu33 commentedComment #13
mogtofu33 commentedComment #14
pdureau commentedComment #15
mogtofu33 commentedComment #16
mogtofu33 commentedComment #17
pdureau commentedRebased.
The MR is proposing:
system.admin_structure:: "Instances / Profile / Preset" instead of "Profile / Preset / Instances"entity.display_builder_profile.collectionrouteWe can ship 1.0.0 without such a change. I remove the
betatag.