Change permissions after menu built
theaksy - December 3, 2008 - 22:05
| Project: | Remove Non-viewable Menu Items |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | ngroot |
| Status: | active |
Jump to:
Description
I love this module... I'm just having one problem. It creates the menu fine based on permissions from content access, but if the permissions are change after it keeps the same menu rather than updating it. So for example, User A can access menu item B, I then change permissions so user A cannot access that node, but the menu item remains, so they click on it and get access denied. If I save item B then the menu is updated so it is no longer visible. Any thoughts? Is there a way to invalidate the menu if any permissions are changed?

#1
Sounds like a caching problem.
#2
I changed the code so that the "poisoned" menu items that make pages not show up in menu items are not cacheable. Please try the development snapshot and see if it fixes the problem.
#3
Many thanks for looking into my issue. I will test the development snapshot asap and let you know. Thanks again!
#4
Hi!
I have tried the dev version and unfortunately it made the issue worse! The menus weren't being processed at all! I am not 100% sure, but using the previous version I have noticed that the menus do appear to update after about 4 hours. I could be wrong, but it would appear something is caching the menu for a while (I have tried it with caching turned off as well with the same results). I think for my situation this should be fine.
Just out of interest I had a look through the code for the module, but unfortunately I wasn't sure what happened to the poisoned_items array when it was passed back (I dont think I'm familiar enough with the internal workins of drupal yet!)
many thanks for your help!
#5
Hi, I found the same problem. I recreated the problem like this:
1.) Installed Content_Access, Acl and developer version (as of Dec 8, 2008) of this module.
2.) Created article with menu in primary links.
3.) Tested the new menu item and it displayed the full article node.
4.) Set the content type article, so that only an authenticated user may view, edit and delete the node.
5.) Looked also at the individual Access Control Tab of the article and also submitted with the same access here (optional step).
6.) Logged out.
7.) Menu item for the article still there, but should have been removed by module!
8.) Logged in again.
9.) Opened Edit-Tab of the article.
10.) Submitted the Edit-Tab of the article without any change.
11.) Logged out again.
12.) Menu item disappeared as expected.
These steps also recreate the problem the other way around when switching on access for anonymous users.
When I investigated further and looked directly into tables, I found that the table "cache_menu" somehow causes the problem. I repeated the same steps from above, but added deleting of the whole contents of cache_menu between step 6 and 7. Result: the menu item disappeared.
The behaviour is the same with release 5.x-1.0 module and with 5.x-1.x-dev module.
Did someone already find a solution?
thanks,
Chris.