forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 permissions => Topic started by: osiris7 on January 01, 2006, 05:48:02 pm

Title: group with special permissions, how to determine?
Post by: osiris7 on January 01, 2006, 05:48:02 pm
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.
 
Title: Re: group with special permissions, how to determine?
Post by: Nibbler on January 01, 2006, 05:54:31 pm
Look for the actual id number of the group in the $USER_DATA['groups'] array, ie.

Code: [Select]
if (in_array(6, $USER_DATA['groups']))
Title: Re: group with special permissions, how to determine?
Post by: osiris7 on January 01, 2006, 06:05:06 pm
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.
Title: Re: group with special permissions, how to determine?
Post by: Nibbler on January 01, 2006, 06:15:11 pm
Only the name of the primary group is available. Internally, Coppermine only uses the group numbers - the names are just for display purposes.
Title: Re: group with special permissions, how to determine?
Post by: osiris7 on January 01, 2006, 06:33:25 pm
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
Title: Re: group with special permissions, how to determine?
Post by: Nibbler on January 01, 2006, 06:49:52 pm
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