The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Refresh iforumpermission cache
Hi.
I tried to retrieve each usergroup permission on a given forum using the getpermission(forumid,0,groupid) function. (it would be too complex doing that uprising the inheritance at database level ... as I tried to do days ago... :hurt: ) But noticed, cycling by the usergroup, a strange behavior based upon the order I tested the groups. Analyzing the code, I realized there's a kind of cache of permission stored each time in global environment. So, for example, if I test first usergroups 6 and 5, I get they CAN access to some forum. If I test them later, after some other groups, I get they CAN'T do the same access to the same forum. Question is simple: how could I bypass this 'cache-due' strange and unpredictable behavior ? Thank you very much. Hope someone could give an answer. Thanks |
#2
|
||||
|
||||
Stick:
Code:
unset($permscache, $usergroupcache); |
#3
|
|||
|
|||
Thanks. It seems working on cleaning cache... At least, when I
change the order of groups I call the function for, I always get the same results... But they are unexpected, mostly for usergroups 5 and 6 !!! I wrote this function (used a function to avoid some side effect coming from global variables not explicitly declared): PHP Code:
masks - I see Admin & Supermods can't access them. Besides, I think there should be some cache interference yet, as - for example - if I test permissions by users with PHP Code:
I see the new group couldn't access that forum ... Instead, it can ! Even, i tried to unset the corresponding GLOBALS[] array variables, as I'm within a function... But results are the same. Any idea ? Thank you very much. |
#4
|
||||
|
||||
You need [minicode]global $permscache, $usergroupcache;[/minicode] in the function.
|
#5
|
|||
|
|||
Btw, OUTSIDE the function,
getpermission($forumid,$userid) doesn't work even on first 20 users. I get 'canview' access only for Admins... When the counter switches to Supermods, I get a "CAN'T" ... If I reverse the sort (counting users from 20 to 1), I get userids 6-8 (supermods) can access... Admins can't .... :eek Thnx |
#6
|
|||
|
|||
For usergroup permissions (in particular for Mods & Supermods) the function behavior is unpredictable.
Where could I find into db such informations ? Thanks. Need help .... |
#7
|
|||
|
|||
FF, you're very avaricious when we're talking about enhanced MySQL DB queries ... aren't you ?
After all, you can do it... Don't ? Quote:
|
#8
|
|||
|
|||
Quote:
cache, even outside the function... If want, please try to upload this code to the admin/ directory and try to execute vs. some private/protected forum (&forumid=xx) and with moderator or supermods usergroup (&grpid=y). Even, a single user (&singleuser=uuu) can be specified. PHP Code:
- if the user belongs to the specified group, permissions are cached (i.e. wrong results if such user has single access mask set) - if not, permissions returned are true (reflecting the actual user ones) - if you copy the same section of $singleuser also before the first getpermissions(), you'll obtain true values ANY CASE, much different from the same code at the end of the script. It means that permissions are cached per usergroup and per forum. And the unsets aren't enough .... Thank you for attention. Any idea ? Bye |
#9
|
||||
|
||||
Ok, now I understand what is wrong. I'll try and fix it...
|
#10
|
|||
|
|||
Quote:
Thanks. Let me know. Bye |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|