Problem/Motivation

Hello,

We can't use the same name for the module and a permission, It visually breaks the Extend UI.

Steps to reproduce

- Create a module named 'Hello' with all necessary (hello.info.yml etc...),

- create a permission file 'hello.permissions.yml' with this

hello:
  title: 'Access hello'
  description: 'Permission to access Hello'
  restrict access: 'true'

- Go to /admin/people/permissions and search your permission : The displayed table is broken

Proposed resolution

Add a prefix "module_" before the $provider in $form['permissions'][$provider] in order to avoid using the same name for the module and permission:
$form['permissions']['module_' . $provider]

Remaining tasks

- Add a test
- Review
- Commit

User interface changes

Existing UI:
Existing UI

Proposed UI:
Proposed UI

API changes

Data model changes

Release notes snippet

Issue fork drupal-2845241

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

LG666 created an issue. See original summary.

cilefen’s picture

Title: We can't use the same name for the module and a permission. » If a permission's machine name is the same as its module's machine name, the Extend UI is visually broken
Component: configuration system » extension system

Indeed, this is true.

cilefen’s picture

Issue summary: View changes

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
larowlan’s picture

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

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

arunkumark’s picture

Version: 9.4.x-dev » 9.5.x-dev
StatusFileSize
new653 bytes

Resolved the issue by creating the following patch. Patch used to resolve the issue on the 9.5.x version.

arunkumark’s picture

Status: Active » Needs review
StatusFileSize
new653 bytes

Also the patch for the Drupal 10.0.X

abhijith s’s picture

StatusFileSize
new94.42 KB
new17.9 KB

Applied patch #15 on 9.5.x and it fixes the issue.

Before patch
before:

After patch:
after

RTBC +1

aarti zikre’s picture

Status: Needs review » Reviewed & tested by the community

changing the status of the issue based on the last comment.

Status: Reviewed & tested by the community » Needs work
ameymudras’s picture

Thanks for the work on this issue, I came across this issue while working on some permissions.
- The patch #15 applies cleanly and works well to resolve the issue
- Issue summary is clear and describes the problem
- After applying the patch there are no warnings, and the permission save works as expected.

ameymudras’s picture

Status: Needs work » Reviewed & tested by the community
quietone’s picture

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

Thanks everyone for getting this to RTBC.

There are a few more things to do before this is ready for a committer. The Issue Summary contains out of date screenshots and does not say how this is being fixed. The "Proposed resolution" section should describe all the changes made in the issue. The "User interface changes" should show the existing UI and the proposed UI. Adding tag for an IS update.

There is no test here so and nearly all patches require a test. It look like the page is tested in \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest. Perhaps one of the existing tests could be expanded to include a test for this fix?

@Abhijith S and @ameymudras, thank you for testing. Your comments state that you applied the patch and it works. For this patch other steps need to be taken and should be listed in what you did to review the patch. I presume a test module was made and a new permission? Did you do or try other things?

And a reminder that when adding screenshots, update the Issue Summary with the before and after screenshots. This will help reviewers and committers a lot.

lucassc’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

Hi!

IS updated with the changes suggested in #22.

lucassc’s picture

Issue summary: View changes

I forgot to remove "TBD" from User interface changes and "Update issue summary" from the Remaining tasks, so I did it now.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

nitin_lama’s picture

Assigned: Unassigned » nitin_lama
nitin_lama’s picture

Assigned: nitin_lama » Unassigned
StatusFileSize
new659 bytes

Adding patch for 10.1.x.

ravi kant’s picture

StatusFileSize
new75.9 KB

Patch #27 is working as accepted. Attaching screenshot.

ravi kant’s picture

Status: Needs work » Needs review
borisson_’s picture

Status: Needs review » Needs work

Still needs tests

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dcam changed the visibility of the branch 2845241-if-a-permissions to hidden.

dcam changed the visibility of the branch 11.x to hidden.

dcam’s picture

Component: extension system » user system
Status: Needs work » Needs review
Issue tags: -Needs tests

The patch in #27 was converted to an MR. I also added a test.

sivaji_ganesh_jojodae’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.93 KB
new114.86 KB
new158.14 KB

Interesting issue. The bug indeed is still around. I can reproduce the issue with the attached test module.

Attached are the screenshots of before and after the MR.

The patch looks straightforward and pipeline looks good as well.

borisson_’s picture

Test looks solid, I think that's good. I wonder if we need a change record for this, but I don't think we do. RTBC++

nod_’s picture

Status: Reviewed & tested by the community » Needs work

Thanks small nit on the test documentation

sivaji_ganesh_jojodae’s picture

Good catch @nod_

dcam’s picture

Status: Needs work » Needs review

I updated the docblock, but I put the reason why I wrote it the way that I did in an MR comment.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

While I agree that adding more functional tests is not great for the total test time duration, having them well documented is important.
We can always change the documentation when we want to add more testing to this.

To me, this change seems like it answers the question by @nod_.

dcam’s picture

I copied and pasted the $next_row variable name from elsewhere in the test class. I forgot to change it and that name isn't relevant to the new test. It bothered me, so I updated it. This is a minor change that doesn't really affect anything, so I'm leaving the issue at RTBC.

  • nod_ committed 19a37c38 on 11.x
    Issue #2845241 by dcam, arunkumark, nitin_lama, suryakumar,...
nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed 19a37c3 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

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