coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 permissions => Topic started by: Naif on June 04, 2007, 05:13:54 PM

Title: Restrict access to the gallery for groups
Post by: Naif on June 04, 2007, 05:13:54 PM
Hello everybody!

I know there is this setting in the Configuration: "Allow unlogged users (guest or anonymous) access", where you can choose either "Yes" or "No".

I'm just wondering, is there any way to allow access only to users who are included in special groups, and block it to the rest (guests and registered users)? I know that this could be done by setting this propierty in all of the albums, but is it possible to do it more quickly somehow?

Thanks!
Title: Re: Restrict access to the gallery for groups
Post by: BT-loader on June 15, 2007, 07:01:39 AM
Quote from: Naif on June 04, 2007, 05:13:54 PM
Hello everybody!

I know there is this setting in the Configuration: "Allow unlogged users (guest or anonymous) access", where you can choose either "Yes" or "No".

I'm just wondering, is there any way to allow access only to users who are included in special groups, and block it to the rest (guests and registered users)? I know that this could be done by setting this propierty in all of the albums, but is it possible to do it more quickly somehow?

Thanks!
I´m wondering the same thing.
Title: Re: Restrict access to the gallery for groups
Post by: Stramm on June 15, 2007, 11:15:28 AM
read the old CPG 1.3 faq about unlogged user access
http://coppermine-gallery.net/demo/cpg13x/docs/faq.htm#registeredUsersOnly
that's pretty much what you need. You just need to adopt the code a lil bit

$USER_DATA['groups'][0]
holds the first group id a user is in

so it'll look for example like
if ($USER_DATA['groups'][0] == 2){
cpg_die(ERROR, 'You do not have access to the gallery', __FILE__, __LINE__);
}