forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 permissions => Topic started by: denerwin on October 16, 2010, 03:29:16 pm

Title: Is it possible to give some users the rights to only edit tags in albums ?
Post by: denerwin on October 16, 2010, 03:29:16 pm
I have a private gallery with some categories and albums. (about Agnetha Fältskog)
Only registered users have access to the gallery and no new users can register.

I have uploaded all the images myself, but now I'd like to edit the tags.

There are many pics in the albums so I don't want to do all the work myself  ;D.
Can I give some users the rights to only edit the tags of pics in one or all albums ?
Title: Re: Is it possible to give some users the rights to only edit tags in albums ?
Post by: Αndré on October 20, 2010, 02:40:34 pm
You'll have to edit some files. Currently it's not possible to do that.
Title: Re: Is it possible to give some users the rights to only edit tags in albums ?
Post by: denerwin on October 20, 2010, 08:09:01 pm
Okay, can you help me with that ?  ;D
Title: Re: Is it possible to give some users the rights to only edit tags in albums ?
Post by: Αndré on October 20, 2010, 08:38:38 pm
We need to adjust 3 'levels' I think:
1. Display the edit file/album button
2. Adjust the permission check for the edit form
3. Adjust the permission check while processing the form data


What exactly do you prefer? Should your users edit the keywords (and just the keywords) file by file (= edit_one_pic.php) or should they be able to edit all files of an album at the same time (= editpics.php).
Title: Re: Is it possible to give some users the rights to only edit tags in albums ?
Post by: denerwin on October 21, 2010, 07:39:48 pm
I would prefer that they were able to edit all the pics in an album ...... :)
Title: Re: Is it possible to give some users the rights to only edit tags in albums ?
Post by: suleyman on December 15, 2010, 01:12:59 pm
Hi FCG-Team & users,
iam new to this board and the first thing i wanna do is tha nk you for your work, because this gallery is great and your support helped me alot in the past.
But, iam on a point where i cant do anything further. I've got the same problem like denerwin, and i don't know where to start!

Could someone please help me with these 3 steps, that was advised by André?

1. Display the edit file/album button
2. Adjust the permission check for the edit form
3. Adjust the permission check while processing the form data

It would be really great.

Wish you a good day!
Post.scriptum: The page (with the gallery) is a Parliament/Funkadelic Tour Archive. If someone is interested to see page, it's no problem. I dont inserted the url here because the site not public yet! =)
Title: Re: Is it possible to give some users the rights to only edit tags in albums ?
Post by: Αndré on December 15, 2010, 02:27:56 pm
1. Display the edit file/album button
Open index.php, find
Code: [Select]
    if (USER_ADMIN_MODE) {
        //check if it is the user's gallery
        if ($cat == USER_ID + FIRST_USER_CAT) {
            return html_albummenu($aid);
        }
       
        if ($owner == USER_ID) {
            //check if admin allows editing after closing category
            if ($CONFIG['allow_user_edit_after_cat_close'] == 0) {
                //Disallowed -> Check if albums is in such a category
                $result = cpg_db_query("SELECT DISTINCT alb.category FROM {$CONFIG['TABLE_ALBUMS']} AS alb INNER JOIN {$CONFIG['TABLE_CATMAP']} AS catm ON alb.category=catm.cid WHERE alb.owner = '" . $USER_DATA['user_id'] . "' AND alb.aid='$aid' AND catm.group_id='" . $USER_DATA['group_id'] . "'");
                $allowed_albums = cpg_db_fetch_rowset($result);
                if (!$allowed_albums || ($allowed_albums[0]['category'] == '')) {
                    return "<strong>" . $lang_album_admin_menu['cat_locked'] . "</strong>";
                }
            }
            if (!$CONFIG['users_can_edit_pics']) {
                //return menu without edit pics button
                return html_albummenu3($aid);
            } else {
                //return whole menu
                return html_albummenu($aid);
            } 
        } else {
            return '';
        }
    }
and replace with
Code: [Select]
    if (USER_ADMIN_MODE) {
        //check if it is the user's gallery
        if ($cat == USER_ID + FIRST_USER_CAT) {
            return html_albummenu($aid);
        }
       
        if ($owner == USER_ID) {
            //check if admin allows editing after closing category
            if ($CONFIG['allow_user_edit_after_cat_close'] == 0) {
                //Disallowed -> Check if albums is in such a category
                $result = cpg_db_query("SELECT DISTINCT alb.category FROM {$CONFIG['TABLE_ALBUMS']} AS alb INNER JOIN {$CONFIG['TABLE_CATMAP']} AS catm ON alb.category=catm.cid WHERE alb.owner = '" . $USER_DATA['user_id'] . "' AND alb.aid='$aid' AND catm.group_id='" . $USER_DATA['group_id'] . "'");
                $allowed_albums = cpg_db_fetch_rowset($result);
                if (!$allowed_albums || ($allowed_albums[0]['category'] == '')) {
                    return "<strong>" . $lang_album_admin_menu['cat_locked'] . "</strong>";
                }
            }
            if (!$CONFIG['users_can_edit_pics']) {
                //return menu without edit pics button
                return html_albummenu3($aid);
            } else {
                //return whole menu
                return html_albummenu($aid);
            } 
        } else {
            return html_albummenu2($aid);
        }
    }


2. Adjust the permission check for the edit form
3. Adjust the permission check while processing the form data
Open editpics.php, find
Code: [Select]
" WHERE p.aid = '$album_id' $owner_str" .and replace with
Code: [Select]
" WHERE p.aid = '$album_id'" .
Now all registered users can also delete files. Use this mod at your own risk!