[development] Deleting Cached Permissions
sysop at scbbs.com
sysop at scbbs.com
Sat Aug 25 06:51:55 UTC 2007
OK, I've modified the user_access() function to utilize the $reset
functionality as described here:
http://www.lullabot.com/articles/a_beginners_guide_to_caching_data
I use something like user_access('reset', NULL, TRUE) to reset the
$perm value in the user_access() function.
However, to make this work, I need to be able to call this function
before other modules call user_access(). So, my question now is: in
what hook should I put my user_access() reset call in order to make it
is always called first before or when loading a node?
Thanks!
-ron
Quoting Moshe Weitzman <weitzman at tejasa.com>:
> it is fine to avoid it with some workaround, ideally you will also
> submit a patch so next time someone else doesn't have to work around
> this.
>
> On 8/24/07, sysop at scbbs.com <sysop at scbbs.com> wrote:
>> Yes, that would be perfect. The problem is that this functionality is
>> currently not in user_access().
>>
>> I looked at the php docs and see that this is possible, but the only
>> way to implement it in user_access() would be to modify the
>> user.module -- which I'm trying to avoid.
>>
>> Quoting Moshe Weitzman <weitzman at tejasa.com>:
>>
>> > it is reasonable to add a param to user_access() called $reset which
>> > if true, kills $perm at beginning of function. this is how other
>> > static caches get rebuilt on demand in drupal.
>> >
>> > On 8/23/07, Ron Parker <sysop at scbbs.com> wrote:
>> >> I wrote this list before on this issue: http://drupal.org/node/166557;
>> >> but, received no response. Decided to re-pose the question.
>> >>
>> >> The problem is that I'm getting the "access denied" error on file upload
>> >> even though the file is uploaded. This is because user_access('upload
>> >> files') is failing for a user who, in fact, has this permission in this
>> >> particular group.
>> >>
>> >> I did the following:
>> >>
>> >> 1. Modified user_access() function to NOT cache the $perm permissions.
>> >> 2. Deleted records from cache_menu.
>> >>
>> >> I don't know which (if not both) of the above did the trick, but it
>> >> resolved the issue. That means (I think) it's a cache problem.
>> >>
>> >> I know I can use cache_clear_all() to delete items from cache_menu.
>> >> However, I would like know if it's possible to delete/modify the static
>> >> $perm variable that is set in the user_access() function OUTSIDE of that
>> >> function?
>> >>
>> >> That is: The user_access() function sets a static variable $perm =
>> >> array(). Permissions are cached in this variable. Can I create a
>> >> function in my module that can update the $perm variable that is set in
>> >> the user_access() function of the node.module?
>> >>
>> >> Thanks for any assistance.
>> >>
>> >> -ron
>> >>
>> >> --
>> >> Ron Parker
>> >> Software Creations http://www.scbbs.com
>> >> Self-Administration Web Site http://saw.scbbs.com
>> >> SDSS Subscription Mgmt Service http://sdss.scbbs.com
>> >> Central Ave Dance Ensemble http://www.centralavedance.com
>> >> R & B Salsa http://www.randbsalsa.com
>> >>
>> >>
>> >
>>
>>
>>
>>
>
More information about the development
mailing list