If you want the obsolete lines in block_roles to disappear after you deleted a role you need to resave the block.
However some modules depend on this table to do their access checks. For example homebox module does this by assuming if no roles are active then permission is granted. Something that is supported by core. However when deleting a role you ll look in the interface and see no roles selected. But for the module checking it, the lines attached to the deleted role will still be their. Resulting in a permission denied if the rid does not fit settings, which it wont because in fact it was deleted.
I think it is better to delete the roles in block_roles when a role is deleted. Like this you dont need to resave a block and other modules logic will still be valid. It keeps things clean.
Maybe allowing a hook here for other module to interact with wont be a bad idea either. In fact all modules that store rids should be given the chance to deleted their rid depending lines in the db. In the second patch there is an example where the block module could then implement the hook and delete its rid depending lines in block_roles.
Patch to delete the block_roles lines is attached.
Patch that invokes a hook attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | delete-block-role.patch | 794 bytes | domidc |
| #15 | hook-role-delete.patch | 1.29 KB | domidc |
| #14 | hook-role-delete.patch | 1.29 KB | domidc |
| #12 | delete-block-role-d6.patch | 794 bytes | domidc |
| #10 | delete-block-role.patch | 808 bytes | domidc |
Comments
Comment #1
domidc commentedOff topic: I just noticed patches here are tested automaticaly? Does this require the patch to be formatted in a certain way?
Comment #2
dpovshed commentedHi domidc,
you're right about patch generation and format.
I feel this info is useful for you
http://drupal.org/patch/create
as well as here you can see auto test algorithm
http://drupal.org/node/332678
At a glance - the files you've submitted will not pass 'valid extension test', disregarding of contents. (.diff OR .patch are required)
Regards, Dennis
Comment #3
domidc commentedTrying to test the patches
Comment #4
domidc commentedAgain
Comment #5
domidc commentedTrying once more
Comment #6
joachim commentedI'm not sure if D6 patches get tested, maybe only D7.
Comment #7
dpovshed commentedHi domidc!
I am setting status of this issue to 'needs review'
For more info - see - http://drupal.org/node/156119
This shall awake the testing bot.
However, according to my experience aand to this thread http://drupal.org/node/961172 , testing bot is in very bad mood these days :/
Comment #9
joachim commentedMaybe those Eclipse lines at the top have flummoxed the bot?
Also, small tweak needed:
Space needed after the //, and a final full stop too. Also, only one role is being deleted, so subject should be singular.
Powered by Dreditor.
Comment #10
domidc commentedRemoved eclipse lines added the space but not sure what you mean with the full stop though?
Comment #11
joachim commentedA full stop at the end of the sentence.
Comment #12
domidc commentedYes of course.
Comment #13
domidc commentedComment #14
domidc commentedHere is the patch for the other possibility of solving this issue
Comment #15
domidc commentedSomehow previous patch got queued for testing.
Adding the other one to try and initiate testing for it.
Comment #16
domidc commentedWrong patch
Comment #17
joachim commentedI don't think adding a hook_role_delete to D6 will fly... best stick to the other approach.
Comment #19
domidc commentedIt is still unclear to me wy the patch fails to be applied. Can someone explain?
@joachim can you explain why having a hook role_delete in D6 wont fly? Hook role delete is perhaps not a good idea. A thing like hook_roleapi with a delete operator is probably better. It think some modules would like to implement features when roles are created/changed/deleted? Now that is not really possible is it?