Problem/Motivation

There are several links to the Permissions page in implementations of hook_help() and in Help Topics. The Permissions page is overwhelming, and we should avoid links to that page.

Steps to reproduce

Proposed resolution

Most of these links specify the relevant module as a fragment, like /people/permissions#module-module_name. After #3216341: Provide a module-specific permissions form, we can replace these with links to the module-specific Permissions page, /admin/people/permissions/module/module_name.

In some cases, we may want to deal with permissions from more than one module. If so, then we can provide a link to /admin/people/permissions/module/module_1,module_2 (two or more module machine names, separated by commas).

Remaining tasks

User interface changes

Change many of the links in Help pages.

API changes

None

Data model changes

None

Release notes snippet

Issue fork drupal-3236443

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

benjifisher created an issue. See original summary.

benjifisher’s picture

Title: Link to module-specific permissions forms in Help Topics » Link to module-specific permissions forms in Help pages
Issue summary: View changes

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

paulocs’s picture

Assigned: Unassigned » paulocs

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Active » Needs review
benjifisher’s picture

Status: Needs review » Needs work

@paulocs:

Thanks for starting work on this issue!

The test failure is not surprising: the test looks for the link we are changing.

The change so far looks like it will update the links on /admin/index and /admin/help/{name}. I did not think of those pages when I created the issue, so I am glad you did!

There is still work to be done for the cases I had in mind: implementations of hook_help(), such as taxonomy_help() in taxonomy.module, and all the help topics under core/modules/help_topics/help_topics/.

You can search that directory for help topics and core/modules/*/*.module for implementations of hook_help(). Or it might be easier to search all of core/modules for user.admin_permissions.

Some places will add the fragment in the Url constructor or Url::fromRoute() and others will add it with Url::setOption() after the object is created.

You can get a head start on updating the tests by searching for admin/people/permisisons.

paulocs’s picture

Assigned: Unassigned » paulocs
paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review
gabriel.abdalla’s picture

Status: Needs review » Reviewed & tested by the community

Hi, I reviewed the code and tested the links in each changed module help page.

Changes look good to me.

benjifisher’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

@gabriel.abdalla:

Thanks for reviewing and testing.

I had a quick look at the changes in the MR, and they look right. When I first looked at the change in the statistics module, it looked broken, but that is just because GitLab (I guess) truncates long lines when viewing diffs "Inline". When I switched to "Side by side" mode, it showed me the actual change.

A complete review should also say something about whether we have updated all the links. Did you search for user.admin_permissions to make sure we did not miss any?

I also do not see any updates in the help_topics module. I mentioned this in the first line of the issue description and in #7.

For example, in core/modules/help_topics/help_topics/action.creating.html.twig I see this line:

{% set action_permissions = render_var(help_route_link(action_permissions_link_text, 'user.admin_permissions', {}, {'fragment': 'module-action'})) %}

If you change that to

{% set action_permissions = render_var(help_route_link(action_permissions_link_text, 'user.admin_permissions.module', {'modules': 'action'})) %}

and enable the action and help_topics modules, then you will see an updated link on /admin/help/topic/action.creating (Link text "Administer actions").

paulocs’s picture

Assigned: Unassigned » paulocs
paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review

Updated all links in help_topic module.
I think that all links were replaced now. Please review.

benjifisher’s picture

Issue summary: View changes

If we can fix this issue in time for 9.3.0, then I think we can add this issue to the change record Permissions can be viewed and edited for one module or a list of modules. I am adding that to the list of remaining tasks in the issue summary.

marcos_lima’s picture

Status: Needs review » Needs work

Hi Everyone. I reviewed the code, in the modules changed and in the help topics as well. Then tested it in every module and in every help topic changed too. As @benjifisher said in comment #11, I searched for user.admin_permissions and checked every mention of it. The patch changes made by @paulocs look good to me, except with the actions help topic, where the link to the permissions page in Administer Actions is not showing.

To reproduce this, enable the help topics module, then go to the help page -> Configuring actions topic -> Creating an advanced action topic, and you can see that the “Administer Actions” link doesn’t show the way it should.

To solve that, you can change this line in core/modules/help_topics/help_topics/action.creating.html.twig:

{% set action_permissions = render_var(help_route_link(action_permissions_link_text, 'user.admin_permissions.module', {'modules': 'module-action'})) %}
To:
{% set action_permissions = render_var(help_route_link(action_permissions_link_text, 'user.admin_permissions.module', {'modules': 'action'})) %}

All other help topics and module changes look good to me.

paulocs’s picture

Assigned: Unassigned » paulocs

Good catch @marcos_lima! Thanks for the review.

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review

Addressed #15.

marcos_lima’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @paulocs! Everything looks good to me now.

paulocs’s picture

I updated the change record as was suggested on comment #14.

See: https://www.drupal.org/node/3223123

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed de537bd and pushed to 9.3.x. Thanks!

I think everyone will appreciate not seeing masses of checkboxes in their dreams after configuring permissions on a Drupal site.

  • alexpott committed de537bd on 9.3.x
    Issue #3236443 by paulocs, benjifisher, marcos_lima: Link to module-...

Status: Fixed » Closed (fixed)

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