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

Version:5.x-1.8» 6.x-1.9

Verify whether or not this issue exists in 6 as well.

#3

Status:needs review» postponed (maintainer needs more info)

I can't duplicate this behavior in 6. Can someone else try?

#4

Version:6.x-1.9» 5.x-1.x-dev
Priority:critical» normal
Status:postponed (maintainer needs more info)» fixed

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

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here