Menu cache not cleared
ckng - April 6, 2009 - 14:44
| Project: | Apply for role |
| Version: | 5.x-1.8 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
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);
#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);