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.

Comments

moshe weitzman’s picture

looks fine. please omit the whole comment which links to lullabot.com

somebodysysop’s picture

StatusFileSize
new1.33 KB

Removed lullabot reference. Thanks.

moshe weitzman’s picture

thx ... patches for core must be generated against HEAD and from the root of drupal.

chx’s picture

Status: Needs review » Closed (won't fix)

Gerhard told you on the mailing list we are not supporting perm changes on-the-fly. I concur.

somebodysysop’s picture

OK, 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.

devin.gardner’s picture

A 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?

somebodysysop’s picture

Version: 5.2 » 6.x-dev
Status: Closed (won't fix) » Fixed

It appears this request has been accepted here: http://drupal.org/node/176342

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

goloops’s picture

i am having problems when applying this patch to og user roles version 5.2 with cygwin, can anyone help me on this? thanks

somebodysysop’s picture

Try og_user_roles.user.module.5.3.patch included in latest OGR download.

goloops’s picture

i 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.

goloops’s picture

Version: 6.x-dev » 5.7
Category: feature » support
Priority: Normal » Critical
Status: Closed (fixed) » Active

i 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.

somebodysysop’s picture

Status: Active » Closed (fixed)

Drupal 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...

somebodysysop’s picture

Version: 5.7 » 6.x-dev
StatusFileSize
new954 bytes

This is the latest 5.x patch to user.module for the cache clearing functionality.

somebodysysop’s picture

Version: 6.x-dev » 5.7
bwood’s picture

It looks like this patch was not accepted in 5.11.