Advanced search  

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]

Pages: [1]   Go Down

Author Topic: group with special permissions, how to determine?  (Read 4315 times)

0 Members and 1 Guest are viewing this topic.

osiris7

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
group with special permissions, how to determine?
« 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.
 
Logged

Nibbler

  • Guest
Re: group with special permissions, how to determine?
« Reply #1 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']))
Logged

osiris7

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: group with special permissions, how to determine?
« Reply #2 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.
Logged

Nibbler

  • Guest
Re: group with special permissions, how to determine?
« Reply #3 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.
Logged

osiris7

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: group with special permissions, how to determine?
« Reply #4 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
Logged

Nibbler

  • Guest
Re: group with special permissions, how to determine?
« Reply #5 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
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.