group with special permissions, how to determine? group with special permissions, how to determine?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

group with special permissions, how to determine?

Started by osiris7, January 01, 2006, 05:48:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

osiris7

hello

first of all my congratulations to all the developers of coppermine, what a great gallery!

At the moment I am implementing different menus for groups. Therefore i created a group called "group1".
In theme.php I added $template_user_admin_menu = <<<EOT ... with all the entries this group should have.

I then thought I could check for the logged in user and his group with USER_GROUP == "group1".

For example in the php file which contains the features for only admins and my special group I have inserted this:

if ((!GALLERY_ADMIN_MODE) && (USER_GROUP != "group1")) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);


My problem now is that the defined variable is "Registered" and not "group1"

Any suggestions what I can do to check especially whether a user belongs to "group1" ??

Thanks a lot.


Nibbler

Look for the actual id number of the group in the $USER_DATA['groups'] array, ie.

if (in_array(6, $USER_DATA['groups']))

osiris7

hi nibbler

thx a lot.
I didn't know this forum is that fast.
Should have posted earlier and it would have saved an hour trying to get this done.

Just one last question. It does work now but is there any possibility to check for a string.
I mean for the name of that user group, in my case "group1"?

Because I think it would keep the code easier to understand.

thanks again.

Nibbler

Only the name of the primary group is available. Internally, Coppermine only uses the group numbers - the names are just for display purposes.

osiris7

ahh okay i understand.

But why is the variable of USER_GROUP then "Registered" for any user instead the admins.
Is USER_GROUP by default "registered" then?

thanks for helping

Nibbler

You either have the user in the registered group as the primary and assigned them into the additional group of group1 or you haven't updated to 1.4.3