Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Renaming a role currently causes the loss of role_delegation permissions for that role.
Comment | File | Size | Author |
---|---|---|---|
#6 | role_delegation_rename_delete_roles_D6.patch | 2.41 KB | Andrew Schulman |
#3 | role_delegation_rename_delete_roles.patch | 2.29 KB | Andrew Schulman |
Comments
Comment #1
Christefano-oldaccount CreditAttribution: Christefano-oldaccount commentedDoes this mean that Role Delegation isn't using role IDs?
Comment #2
David Lesieur CreditAttribution: David Lesieur commentedThe problem is that the permission names created by Role Delegation are derived from role names, and Drupal uses permissions names as IDs. Using role IDs is not an option here, as that would make the Access control settings unusable.
Something we could probably do is updating the permissions when the role editing form ("user_admin_role") is submitted.
Comment #3
Andrew Schulman CreditAttribution: Andrew Schulman commentedThe attached patch does this. When role X is renamed or deleted, we rename or delete (resp.) the "assign X role" permission in every entry in the permission table. Please test.
Comment #4
Andrew Schulman CreditAttribution: Andrew Schulman commentedDavid, do you plan to merge this patch? Do you think it's too complex, or the problem not common enough to be worth fixing? Or have you just not gotten to test it?
I tested the patch at the time I wrote it, and it worked fine. I haven't tested it lately, but I can do so again, and update it against the latest CVS.
The reason I ask now is that D7 will be out soon, and role delegation has a working D7 port. I could port this patch to D7 too, but I don't see any benefit to doing that if you don't plan to merge it.
Thanks,
Andrew.
Comment #5
David Lesieur CreditAttribution: David Lesieur commentedI think the patch would be a good thing, but have not tested it yet. (sorry!)
Comment #6
Andrew Schulman CreditAttribution: Andrew Schulman commentedOK, I remade the patch against current D6 CVS. Here it is.
I tested it again and it works fine. Permissions are renamed and deleted when roles are renamed and deleted. Could someone else please also test it?
D7 has a new API for managing roles. I'll port the patch to that as I have time.
Comment #7
Andrew Schulman CreditAttribution: Andrew Schulman commentedA simple test case, labeled "Role editing", has been added in D7, to test whether this works. So far it doesn't, since the patch above hasn't been ported to D7 yet.
Comment #8
Andrew Schulman CreditAttribution: Andrew Schulman commentedFixed in D6 and D7 -dev branches. D7 branch now passes the "Role editing" simple tests, confirming that "assign role" permissions are being correctly renamed or deleted when roles are renamed or deleted.