Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When a user role is deleted, other modules don't get informed, leaving outdated incorrect data in module tables that store user roles relationships.
In core, at least {book_role} and {filter_format} store roles relationships.
Comment | File | Size | Author |
---|---|---|---|
#4 | user-roles-API.patch | 6.32 KB | dropcube |
#1 | hook_user_role_delete.patch | 2.97 KB | dropcube |
Comments
Comment #1
dropcube CreditAttribution: dropcube commentedThis patch introduces
hook_user_role_delete
, a hook that would allow modules to act when a use role is deleted.The hook is implemented in filter.module and block.module.
I am marking this critical, to get some attention before the freeze, as this introduces a new hook (API), .
Comment #2
Dries CreditAttribution: Dries commentedI agree that this is a useful function, but shouldn't we have hooks for adding and updating too -- for consistency?
Comment #3
dropcube CreditAttribution: dropcube commentedCurrently, I can't see a case when a module might need to act when a role is updated (role name changed), but might be later. So, yes, for consistency.
Comment #4
dropcube CreditAttribution: dropcube commentedThis patch adds:
- API functions to manipulate user roles:
user_role_load($rid)
,user_role_save($role)
,user_role_delete($role)
- hooks
hook_user_role_insert($role)
,hook_user_role_update($role)
,hook_user_role_delete($role)
- Implementation of
hook_user_role_delete()
in core modules filter.momdule and block.mdouleComment #5
dropcube CreditAttribution: dropcube commentedtagging
Comment #6
dropcube CreditAttribution: dropcube commentedTagging.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commented@dropcube could you look at the patch at #300993: User roles and permissions API and borrow the testing code and anything else that makes sense? then continue this fine work here or there.
Comment #8
dropcube CreditAttribution: dropcube commentedOk, I will take that issue, marking this as duplicate.