Closed (fixed)
Project:
Administration menu
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Aug 2009 at 15:01 UTC
Updated:
3 Jan 2014 at 00:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
c960657 commentedSubscribing.
Comment #2
sun#613668: Empty menu item for admin/user/profile additionally mentions that admin_menu contains stale links after uninstalling a module.
Comment #3
DifferentFC commentedSubscribing, too.
Someone should debug, please.
Comment #4
sunComment #5
petsagouris commentedSee possible duplicates
#1322942: "Web Master" elevated role can only see home icon, 0/1, hello [username] and logout.
#1337864: admin menu doesn't take consideration for users' permissions
Comment #6
mstrelan commentedI think there are two parts to this issue, first is a user's role(s) changing and second is permissions for a role changing. To address the first part we can use the following code.
I think there must be a more efficient way to compare user roles, but this is the best I could come up with. I also wonder if we ought to modify the
admin_menu_flush_caches()function to accept a user id or a session id to perform the bottom half of the above function. Then instead we could simply calladmin_menu_flush_caches($account->uid);when the role change is detected.I also wonder if it's legal in Drupal to manually clear the cache tables with a db_query(), in case the user has many sessions we can just do one query instead of many.
For the second part of the issue, permission changes for a role, I believe we can implement hook_user_role_update(). If not we would probably have to hook_form_alter() the permissions page and add a custom submit handler which sounds a lot more painful.
Comment #7
mstrelan commentedOk so some further digging shows that submitting the permissions form already calls cache_clear_all() so we shouldn't have to do anything special in admin_menu when permissions change, only when a user role changes. Therefore I would like some feedback on the approach in my comment above and will then be happy to submit a patch.
Comment #8
mstrelan commentedAlso, the comment in #2 no longer applies to D7 since
drupal_flush_all_caches()is called in thesystem_modules_submit()function therefore #613668: Empty menu item for admin/user/profile could potentially be reopened for D6 only?Comment #9
sunAttached patch fixes this issue and proves that in a test.
Comment #11
mstrelan commentedI can confirm that #9 works for editing a user's roles, editing the permissions for a role and deleting a role.
Comment #12
sunRan the tests locally, due to that testbot hiccup - which revealed that the test changes broke another/existing test. Fixed that, and,
Thanks for reporting, reviewing, and testing! Committed to all branches.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.