forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 permissions => Topic started by: jleonard on May 08, 2012, 03:03:10 pm

Title: Category Permissions/Access
Post by: jleonard on May 08, 2012, 03:03:10 pm
I apologize if this has already been answered, but I could not find a thread addressing this issue.  I have at least 50 albums, so for me to change access permissions "by album" (via creating a password), is extremely tedious.  Is there a way for me to create a password for an entire category?  If not, is there a way to "batch" create a password for all of these albums?
Title: Re: Category Permissions/Access
Post by: jleonard on May 08, 2012, 03:07:51 pm
Actually, it's over a 100 albums.
Title: Re: Category Permissions/Access
Post by: Αndré on May 08, 2012, 03:29:57 pm
Is there a way for me to create a password for an entire category?
That not possible.


is there a way to "batch" create a password for all of these albums?
Set the password for one album. Then, have a look at your database and find that album to get the password hash. Now you can execute a query like
Code: [Select]
UPDATE cpg15x_albums SET alb_password = '098f6bcd4621d373cade4e832627b4f6' WHERE category = '123'
Title: Re: Re: Category Permissions/Access
Post by: jleonard on May 08, 2012, 08:44:36 pm
That not possible.

Set the password for one album. Then, have a look at your database and find that album to get the password hash. Now you can execute a query like
Code: [Select]
UPDATE cpg15x_albums SET alb_password = '098f6bcd4621d373cade4e832627b4f6' WHERE category = '123'

Interesting...thanks for writing.  Could I also do the same for the Password Hint?  Where would I paste that code, would it be "within" the database, or via the gallery somehow?  I can go into mysql database, but I'm not that familiar with how to edit multiple fields or entries.
Title: Re: Category Permissions/Access
Post by: Αndré on May 09, 2012, 08:46:05 am
Could I also do the same for the Password Hint?
Sure. The query would look like
Code: [Select]
UPDATE cpg15x_albums SET alb_password = '098f6bcd4621d373cade4e832627b4f6', alb_password_hint = 'test' WHERE category = '123'
Title: Re: Re: Category Permissions/Access
Post by: jleonard on May 09, 2012, 03:09:07 pm
Sure. The query would look like
Code: [Select]
UPDATE cpg15x_albums SET alb_password = '098f6bcd4621d373cade4e832627b4f6', alb_password_hint = 'test' WHERE category = '123'

So, where do I enter that code?  Somewhere in the gallery settings, or somewhere in MySQL?
Title: Re: Category Permissions/Access
Post by: Αndré on May 09, 2012, 03:30:05 pm
In PHPMyAdmin or a similar tool.
Title: Re: Re: Category Permissions/Access
Post by: jleonard on May 09, 2012, 03:43:11 pm
In PHPMyAdmin or a similar tool.

Would anyone be willing to give me instructions to do this?  I'm not a script programmer, I'm just a photographer.

Thanks in advance.
Title: Re: Category Permissions/Access
Post by: Αndré on May 09, 2012, 03:49:20 pm
Login to PHPMyAdmin, select your Coppermine database, open the "SQL" tab, copy the adjusted query to the text box and hit "Go".
Title: Re: Re: Category Permissions/Access
Post by: jleonard on May 10, 2012, 07:40:09 pm
Login to PHPMyAdmin, select your Coppermine database, open the "SQL" tab, copy the adjusted query to the text box and hit "Go".

Thanks.  Did that, and it returned a green checkmark, but says "0 rows affected".  Here was my edited code...

UPDATE cpg_albums SET alb_password = 'mckinney', alb_password_hint = 'In what city do the Leonards live? (all lowercase)' WHERE category = '2012'
Title: Re: Category Permissions/Access
Post by: jleonard on May 10, 2012, 07:44:31 pm
And now I can't even login to my admin account!
Title: Re: Category Permissions/Access
Post by: Αndré on May 10, 2012, 08:40:00 pm
You have to enter the category's ID, not the category's name at the bold part:
UPDATE cpg_albums SET alb_password = 'mckinney', alb_password_hint = 'In what city do the Leonards live? (all lowercase)' WHERE category = '2012'
Title: Re: Re: Category Permissions/Access
Post by: jleonard on May 10, 2012, 08:44:55 pm
You have to enter the category's ID, not the category's name at the bold part:

Ok, I'll try that, thanks. So, how did this query mess up my logins?  It doesn't even recognize my login anymore. The users are still listed in the databases however.
Title: Re: Category Permissions/Access
Post by: Αndré on May 10, 2012, 08:56:01 pm
I don't know, as if haven't tested it. Do you get an error message? I guess Coppermine tries to access a non-existing category.


Additionally, your password is invalid. Please read my first reply how to get a valid password.
Title: Re: Re: Category Permissions/Access
Post by: jleonard on May 10, 2012, 09:00:14 pm
I don't know, as if haven't tested it. Do you get an error message? I guess Coppermine tries to access a non-existing category.


Additionally, your password is invalid. Please read my first reply how to get a valid password.

Error returns "Login failed.  Try again."

I read your first post...what's a password "hash?"
Title: Re: Category Permissions/Access
Post by: jleonard on May 10, 2012, 09:01:48 pm
And when I try to access the particular "album" via password, it says "invalid password."
Title: Re: Category Permissions/Access
Post by: Αndré on May 10, 2012, 09:26:27 pm
when I try to access the particular "album" via password, it says "invalid password."
That's what I already told you. Please just follow my instructions (copy an already existing hash).


what's a password "hash?"
That's the value which is stored e.g. in the alb_password field. More information here (http://en.wikipedia.org/wiki/MD5#MD5_hashes).


I guess Coppermine tries to access a non-existing category.
That's of course nonsense. I mixed up two threads, sorry.
Title: Re: Category Permissions/Access
Post by: jleonard on May 10, 2012, 09:58:16 pm
OK, I'm not explaining myself very well apparently.  I have two issues now...

1.  The album passwords:  I changed them all to a word, not a hexadecimal string.  Again, I am not a programmer, so when you said to copy the code, I did...and I entered a regular word, not a hexadecimal string.  So, the strings are all gone now...and I can't even login to the gallery to create a password because of No. 2 below!

2.  The User Login passwords:  NONE of them work anymore!  I can't login to my gallery...at all.
Title: Re: Category Permissions/Access
Post by: jleonard on May 11, 2012, 01:13:35 am
Andre, please help if you can.  My gallery is completely innaccessible since I edited the database, and I've given out the link to a bunch of parents for a baseball team.  I don't know why I cannot login from any user (or admin) account since I ran those queries.
Title: Re: Category Permissions/Access
Post by: Αndré on May 11, 2012, 06:37:49 am
I don't know what exactly you did, but that query shouldn't affect the user logins. To investigate that issue I just sent you a PM.
Title: Re: Category Permissions/Access
Post by: jleonard on May 11, 2012, 07:22:13 pm
Thanks for helping out.  Not sure what happened, but I was able to hit "forgot your password?" and created a new admin password, which allowed me to go into one album and create the password to use for the code.

Thanks again.