Currently, user_access() declares the static $perm variable. Effectively, permissions returned in this function are cached. Currently, there is no way to empty this cache.
The attached patch provides a "reset" functionality for the user_access() function so that module developers can empty or reset the cached permissions when necessary.
This functionality is pretty basic, but was required to solve my permissions problem here: http://drupal.org/node/165723
I studied this tutorial and used it as the basis for the supplied patch: http://www.lullabot.com/articles/a_beginners_guide_to_caching_data
Even if this patch is not accepted, I believe there still should be some way to reset the permissions cache created by user_access(). It appears that every other cache created can be manually reset except this one.
Thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | og_user_roles.user_.module.5.3.patch | 954 bytes | somebodysysop |
| #2 | og_user_roles.user_.module.5.2-1.patch | 1.33 KB | somebodysysop |
| og_user_roles.user_.module.5.2.patch | 1.4 KB | somebodysysop |
Comments
Comment #1
moshe weitzman commentedlooks fine. please omit the whole comment which links to lullabot.com
Comment #2
somebodysysop commentedRemoved lullabot reference. Thanks.
Comment #3
moshe weitzman commentedthx ... patches for core must be generated against HEAD and from the root of drupal.
Comment #4
chx commentedGerhard told you on the mailing list we are not supporting perm changes on-the-fly. I concur.
Comment #5
somebodysysop commentedOK, but I don't understand why that would prevent you from allowing someone to clear this permissions cache if that's what they want to do. Is there a specific reason, besides it would help with what I'm doing, that you would NOT want to ever allow someone to clear this cache? Just curious.
Comment #6
devin.gardner commentedA lot of problems seem to be coming up with group-specific roles because of the permission caching (I found this thread because I just now came upon another problem with it). Why in the world would you not want to have an option to reset this for a single user, when it doesn't affect Drupal's normal functioning (or performance) in any way?
Comment #7
somebodysysop commentedIt appears this request has been accepted here: http://drupal.org/node/176342
Comment #8
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
goloops commentedi am having problems when applying this patch to og user roles version 5.2 with cygwin, can anyone help me on this? thanks
Comment #10
somebodysysop commentedTry og_user_roles.user.module.5.3.patch included in latest OGR download.
Comment #11
goloops commentedi have successfully patched with 5.3 patch, but i still cannot get it to work with creating og projects and og groups( still get the access denied error). please help me on this thanks a lot.
Comment #12
goloops commentedi have successfully patched with 5.3 patch, but i still cannot get it to work with creating og projects and og groups( still get the access denied error). please help me on this thanks a lot.
Comment #13
somebodysysop commentedDrupal Issues is not the place to make this request. The patch in question is supplied by a contributed module. It is NOT part of core. If ithis is an OG User Roles Issue, then that's where you should post your question. You also need to define exactly what your problem is: What modules are involved, exactly what is not working, etc...
Comment #14
somebodysysop commentedThis is the latest 5.x patch to user.module for the cache clearing functionality.
Comment #15
somebodysysop commentedComment #16
bwood commentedIt looks like this patch was not accepted in 5.11.