[development] The static $perm variable in user_access
Ron Parker
sysop at scbbs.com
Thu Oct 30 17:32:07 UTC 2008
The static $perm variable in user_access() contains the permissions that users have. When user_access('ClearCache', NULL, TRUE) is executed, the static $perm value is emptied and re-filled with permissions from the current roles in the $user object . Theorectically, when user_access() is next called, assuming the $ user object contains the same roles, the $perm variable should contain the same permissions which were cached in the first call. This is what happened in Drupal 5.x and the earlier versions of 6.x. This is NOT happening (at least consistently) in the most recent versions of the user.module .
I've written a bunch of debug code in the user, node and ogur modules and now have more details. I am printing the output of user_access () every time it is called.
When I issue:
user_access('ClearCache', NULL, TRUE)
Static $perm variable is cleared and re-filled with permissions from current $user object. This is correct.
When module_invoke () is immediately executed next:
module_invoke('node_content', 'access', 'create', 'story', $user)
It will now make another call to user_access() :
user_access('create story content', $user)
The $user object still contains the same roles. The $perm variable now contains values. This is correct. But the values in $perm are NOT the same as those inserted during the ClearCache call above! They have changed, and NOT from the user_access() function (which I am monitoring)! So the question is: Why has this $perm value changed?
So far, I've found this behaviour occurs with OGUR when one of the following modules is installed:
• taxonomy_access
• tac_lite
• menu_breadcrumb
• admin_menu
I so far am unable to discover what it is about these modules which is causing this problem. This did not occur in 5.x and earlier 6.x versions of Drupal.
Please, please, please help!
-ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20081030/c01a5fd9/attachment-0001.htm
More information about the development
mailing list