Posted by ckng on April 6, 2009 at 2:44pm
Jump to:
| Project: | Apply for role |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Menu cache is causing permission problem for added/removed roles.
apply_for_role only called cache_clear_all() without argument, from the api doc, it does not clear menu cache:
Expire data from the cache. If called without arguments, expirable entries will be cleared from the cache_page and cache_block tables.
To replicate the problem, set permission to add a content type says Story to role A. Grant the role A through apply_for_role, and go to node/add/story will give you permission denied.
Patch:
- added the following line to all cache_clear_all() calls.
cache_clear_all('*', 'cache_menu', TRUE);- OR -
just that user
cache_clear_all($form_values['user']->uid.':', 'cache_menu', TRUE);
Comments
#1
I can confirm that this is a problem. I used the second patch suggestion, and it worked perfectly:
cache_clear_all($form_values['user']->uid.':', 'cache_menu', TRUE);
#2
Verify whether or not this issue exists in 6 as well.
#3
I can't duplicate this behavior in 6. Can someone else try?
#4
Applied cache_clear_all($form_values['user']->uid.':', 'cache_menu', TRUE); to 5 -dev.
cache_clear_all($account->uid . ':', 'cache_menu', TRUE) was removed from user_edit_submit() in D6.
So this seems to be a 5 only issue which would be why I couldn't reproduce.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.