Problem/Motivation

I have some user roles that I would like to be able to view the overview page, but not add, edit, or delete.

Proposed resolution

Add a new permission:
access custom tokens overview:
title: 'Access the custom tokens overview page'

Remaining tasks

Should we add individual permissions for add, edit, and delete?

User interface changes

Go to /admin/people/permissions/module/token_custom and there will be a new permission:
Access the custom tokens overview page
screenshot of new permission to access custom tokens overview page

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

capysara created an issue. See original summary.

capysara’s picture

Status: Active » Needs review

I create a MR to add a new permission for viewing the overview admin page. I think it would be helpful to have other individual permissions, but this addition is good start.

bhogue’s picture

StatusFileSize
new267.25 KB

I can confirm the patch adds the requested permissions and those permissions can be set/unset without error.

screenshot of permissions page with new permissions available

anybody made their first commit to this issue’s fork.

anybody’s picture

Status: Needs review » Needs work

Thanks, I understand the use-case. Improved this a bit, but still the tests need to address the new permission.

grevil made their first commit to this issue’s fork.

grevil’s picture

Assigned: capysara » Unassigned
Status: Needs work » Reviewed & tested by the community

Tests don't need any changes, they were broken before and just got fixed.

LGTM!

grevil’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

Although the changes do not match the Issue-Summary:

I have some user roles that I would like to be able to view the overview page, but not add, edit, or delete.

But the code:

entity.token_custom.collection:
  path: '/admin/structure/token-custom'
  defaults:
    _title: 'Custom tokens'
    _entity_list: 'token_custom'
  requirements:
    _permission: 'administer custom tokens+access custom tokens overview'

says that the user needs both permissions (add + edit + delete + overview access) to see the collection.

Either update the issue summary or the code.

anybody’s picture

@grevil: I think you're wrong, the + is just a bit misleading...

See
_permission: A permission string (for example _permission: 'access content'). You can specify multiple permissions by separating them with ',' (comma) (_permission: 'access content,access user profiles') for AND logic or '+' (plus) for OR logic (_permission: 'access content+access user profiles' means a visitor needs either the access content permission or the access user profiles permission to view the page.)
https://www.drupal.org/docs/drupal-apis/routing-system/structure-of-routes

grevil’s picture

Status: Needs work » Reviewed & tested by the community

Wow, who though of that! 😅

Ok, my apologies. LGTM then!

  • grevil committed 04058b59 on 8.x-1.x authored by capysara
    #3538085: add more granular permission to view custom tokens overview...
grevil’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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