Log in

View Full Version : Usergroup bitfield permissions - conflict issue ?


cinq
03-18-2005, 11:00 PM
I need some help trying to figure this out.

I use the following in my includes/init.php for my hack :

$_BITFIELD['usergroup']['vbarticlespermissions'] = array(
'canviewarticles' => 1,
'cansubmitarticles' => 2,
'cancommentonarticles' => 4,
'canratearticles' => 8,
'caneditdelowncomments' => 16
);


If there are other bitfields further up/down in the init.php file with a similar bitfield name, say 'canviewarticles'


$_BITFIELD['usergroup']['notvbarticlepermissions'] = array(
'canviewarticles' => 1
);


There shouldn't be any conflict, since the names of the array is different, right ? ( note the parts in bold in both code segments above )
Or am I mistaken, because it seems it does matter. ( the bitfield name )
Any help would be most appreciated :)

deathemperor
03-19-2005, 12:34 AM
no, it won't conflict until the array name is not the same. (and hehe, you can't bold anything in [php])

this is simple but why wouldn't you try it before asked ^^ ?

cinq
03-19-2005, 12:53 AM
Like i said, it seems it does matter ( because I tried it )

Now I am wondering, why should it ?? :(

Marco van Herwaarden
03-19-2005, 08:41 AM
It does matter. All bitfield permissions are automatically set during init. In the init these are still 2 different permissions, but both are set to be used as 'CANVIEWARTICLES'. This means you could still test against the array if you have permissions, but you can't use CANVIEWARTICLES anymore.

cinq
03-19-2005, 11:50 PM
So we're saying that such an if conditional in the template :


<if condition="$permissions['vbarticlespermissions'] & CANVIEWARTICLES">

won't take the permissions from my vbarticlespermissions, because there is a confusion with another permissions array ?

Very odd isn't it, then why bother putting them in their own groups in the first place ??

cinq
03-30-2005, 03:29 AM
anyone ?

Marco van Herwaarden
03-30-2005, 04:03 AM
They are put in their own groups because each group is stored as a seperate column in the database.

Putting them all together would require huge permission values.