I found this reported at #2328411-78: Convert all permissions to yml files and permission callbacks, but not a full issue.
Problem: The modules list at admin/modules should be including 3 admin links per module, where available: Help, Configure, and Permissions. With the move to modulename.permissions.yml files, the call to $this->moduleHandler->getImplementations('permission') in ModulesListForm.php returns no modules.
Proposed solution:
- Fix it
- Add test coverage for this link. Cover the help links in a follow-up.
Beta phase evaluation
| Issue category | Bug because this fixes a regression. |
|---|---|
| Issue priority | Normal because there is a workaround. |
| Prioritized changes | The main goal of this issue is fixing a bug—it is prioritized. |
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | added-new-line-at-end-2513626.patch | 481 bytes | naveenvalecha |
| #9 | regression_module-2513626-9.patch | 5.03 KB | cilefen |
| #9 | regression_module-2513626-9-TESTS.patch | 1.49 KB | cilefen |
| #8 | regression_module-2513626-8.patch | 3.54 KB | cilefen |
| #8 | interdiff-2513626.txt | 3.24 KB | cilefen |
Comments
Comment #1
akalata commentedComment #2
akalata commentedComment #3
akalata commentedComment #4
akalata commentedComment #5
akalata commentedComment #6
les limLet's inject the
user.permissionsservice so we can use$this->permissionHandlerinstead.We already have $this->currentUser, so no need for \Drupal::currentUser() here. (That has nothing to do with your patch, but it's an easy thing to fix here.)
Also, since testbot didn't catch it, that means we probably need a test.
Comment #7
les limSure enough,
\Drupal\system\Tests\Form\ModulesListFormWebTestchecks for a configure link, but not a permissions link.Comment #8
cilefen commentedComment #9
cilefen commentedHere is a tests-only patch and a full patch.
Comment #11
les limFor the sake of completeness, we should also test that the "Help" link is shown. Some day we'll want to get rid of hook_help(), too.
Comment #12
cilefen commented#11 is out-of-scope. Add another issue for that.
Comment #13
cilefen commentedComment #14
cilefen commentedComment #15
les limAdded #2516690: Missing test for "Help" links per module on "Extend" admin page for testing the Help link.
Comment #16
cilefen commentedComment #17
les limThis is strange -- there's a previously existing system_test.permissions.yml file, but it's in the "src" directory. Does that even work? Git tells me it comes from #2464659: Routes that are varied by the 'user.permissions' cache context for anonymous users must also get the anonymous Role's cache tag.
Comment #18
cilefen commentedThat is strange. Permissions files don't go there.
Comment #19
cilefen commentedIt may be that *both* files are being read. Can you see if PageCacheTest fails without the other permisisons.yml file present? I think it will.
Comment #20
les limPageCacheTest passes even without any system_test.permissions.yml.
Technically, permissions.yml isn't required for testing; a permission check is just looking for a string, and that string is programmatically applied to the test user directly in the test method:
So I'd venture to say that the YAML file in "src" isn't doing anything at all.
Comment #21
cilefen commentedI don't want to just remove the file in this issue because #2464659: Routes that are varied by the 'user.permissions' cache context for anonymous users must also get the anonymous Role's cache tag intended it to be there, right or wrong. I think this calls for another novice issue and #9 is still open for review.
Comment #22
les lim#9 is well-formatted, narrowly scoped, and has verified tests. Looks good to me.
Comment #23
les limAdded novice task #2517114: Remove needless, wrongly-placed system_test.permissions.yml file, postponed on this issue.
Comment #24
webchickNice catch!
Committed and pushed to 8.0.x. Thanks! Go TC Drupal Go! :D
Comment #26
naveenvalechaThanks!
Added new line at the end of system_test.permissions.yml
Comment #27
cilefen commentedAnother follow-up issue: #2521758: Module anchors on Permissions pages do not get you where you would expect
Comment #28
naveenvalechachanging as per #26
Comment #29
cilefen commented@naveenvalecha It has already been committed. Open a follow-up issue to fix any missed problems.
Comment #30
cilefen commentedOh a committer knows about it. Ignore #29.
Comment #31
alexpott@naveenvalecha please open a follow-up issue - doing follow-ups on issue pollutes issue credit history.
Comment #32
alexpottAnd once the follow-up is created and linked can this issue by set to fixed.
Comment #33
naveenvalechaThanks! @alexpott! Fine to create the followup. Added followup https://www.drupal.org/node/2521774