Closed (fixed)
Project:
Administer Users by Role
Version:
8.x-3.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Jun 2022 at 09:46 UTC
Updated:
26 Aug 2022 at 11:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
snowee@swis.nl commentedComment #3
snowee@swis.nl commentedComment #4
snowee@swis.nl commentedComment #5
immaculatexavier commentedI've attached the patch in accordance with the proposed resolution.
Comment #6
timohuismanI tested #5 and the problem is solved. Without the patch the list of roles on a user form is not visible, with the patch I can see and change the list of roles.
Comment #7
snowee@swis.nl commentedNew patch that reverts 97ef94b11e2ad3a410ea26e8e0990ed44809b27d and includes the account fix by immaculatexavier.
Comment #8
timohuismanI tested #7 and it solves the problem as well.
Comment #9
kburakozdemir commentedI tested #7 and it solves the problem.
Comment #10
pminf@snow_ee Thank you for your work! Actually your patch #1 already solves the issue. In my opinion #5 is an unnessessary and unrelated change which doesn't improve the code quality. And next time you improve patches, please attach an interdiff to make the differences between the patches clear (like immaculatexavier did in #5).
Comment #11
matthiasm11 commented+1 for patch #7.
Comment #12
gngn commentedTrying to sort out the proposed patches ... all of them solve the issue at hand.
But they do it a little bit differently and some do more than just solving the issue:
!empty($options);(and thus reverts commit 97ef94b).
It also adds the so called "account fix":
\Drupal::currentUser();instead ofDrupal::currentUser();It also keeps the "account fix".
I agree with pminf in #10 that the "account fix" is an unrelated change - but I'm not so sure wether it's unnessessary and I do think it improves code quality because:
\Drupal::currentUser();(with leading slash)Maybe we should open a new issue for the "account fix" (which should also change the other two
\Drupal::currentUser();) ...That said I propose to just solve the current issue (i.e. get rid of the "account fix") and do this by by explicitly setting '#access' to TRUE if $options is not empty (like #5).
I also think it is nice to document this behaviour.
This way we reduce the risk of repeating the same error again.
What do you think?
Comment #13
adamps commentedThanks everyone for the contributions.
Background
The commit that caused the problem was part of #3188812: Module overrides previously set #access on roles form element (I added that into the IS). If we fix this, then I believe we must undo that issue. However I now see that the OP of that issue commented after the issue was closed (hence I didn't notice) to suggest reverting. So I think it's fine. The MR on #3182353: Not possible to configure the roles on Drupal 9 was also made on an already closed issue, so this problem has remained hidden😃.
Proposal
Drupal::currentUser() should have a slash to cancel any existing namespace but it doesn't actually cause a bug in a module file because there is no namespace.
Comment #14
tijsdeboeckI've tested patch #12, and it worked for us.
Comment #15
adamps commentedHere is my preferred variation. I realised that we don't need to remove existing access which could have been granted by another module. New patch only adds access, which is that same as the rest of the module.
Please can someone test, then I will commit and make a new release.
Comment #16
tijsdeboeckTested patch #15, it works!
Comment #18
adamps commentedGreat thanks