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: Batch add to user albums, but editing reassigns to different album  (Read 11765 times)

0 Members and 1 Guest are viewing this topic.

Blueiris

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 170
  • Horse poor!
    • Saddlebred World Gallery

In both cpg142 and cpg143, the admin can batch add files to user albums. The files will display in that user album, and be counted in the total files for that album.

However, if the admin then use editOnePic.php and makes a change on one of the batch files, that file will be moved to one of admin's albums. The user album name does not show up in the dropdown menu on that page.

If the admin uses editpics.php, any files that the user had uploaded to that album will show the user album name in the dropdown, but the batch added files will not. Any change to any one or all of the files, batch added or not, will result in all of the batch added files being moved to one of the admin's albums. The user's uploads will stay put.

If the user attempts to edit one pic or all, the user's album name appears in the drop down menu for all the files, including the batch added files, so for the user, editing works as it should and doesn't move any files.

If the admin is to be allowed to batch add files to user albums, then those albums should stay where put unless the admin or the user chooses to move them or delete them. I'm not sure how this was intended to work, so I'm not sure whether the fix is to eliminate the admin option to batch add to user albums, or to fix editOnePic.php and editpics.php so that the users album name shows in the dropdown for any files that were batch added to the user album.


« Last Edit: February 04, 2006, 12:56:08 pm by GauGau »
Logged
You can lead a horse to water, but you can't make him drink - he's got to discover that it's wet for himself.

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Batch add to user albums, but editing reassigns to different album
« Reply #1 on: February 02, 2006, 01:05:59 pm »

Yes...you are right.

Edit editOnePic.php

Replace

Code: [Select]
function get_user_albums($user_id = '')
{
        global $CONFIG, $USER_ALBUMS_ARRAY, $user_albums_list;
       
        if ($user_id != '') {
                $or = " OR category='" . (FIRST_USER_CAT + $user_id) . "'";
        }

with

Code: [Select]
function get_user_albums($user_id = '')
{
        global $CONFIG, $USER_ALBUMS_ARRAY, $user_albums_list, $CURRENT_PIC;

        if ($user_id != '') {
                $or = " OR category='" . (FIRST_USER_CAT + $user_id) . "'";
        } else {
          $or = " OR aid='{$CURRENT_PIC['aid']}'";
        }

Edit editpics.php

Replace

Code: [Select]
function get_user_albums($user_id = '')
{
        global $CONFIG, $user_albums_list;

        $USER_ALBUMS_ARRAY=array(0 => array());

        if ($user_id != '') {
                $or = " OR category='" . (FIRST_USER_CAT + $user_id) . "'";
        }

with

Code: [Select]
function get_user_albums($user_id = '')
{
        global $CONFIG, $user_albums_list, $CURRENT_PIC;

        $USER_ALBUMS_ARRAY=array(0 => array());

        if ($user_id != '') {
                $or = " OR category='" . (FIRST_USER_CAT + $user_id) . "'";
        } else {
          $or = " OR aid='{$CURRENT_PIC['aid']}'";
        }

@Roberta: Please see whether this solves the problem.

@Devs: Is the current behaviour intended or is it a bug? Should the fix go in cvs?


Abbas
Logged
Chief Geek at Ranium Systems

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Batch add to user albums, but editing reassigns to different album
« Reply #2 on: February 02, 2006, 03:02:45 pm »

hm, it's a design question imo: should we allow the admin to upload into personal galleries? Yeah, I know, the old "admin should be capable to do just everything" dispute. I'm not sure if this shouldn't be fixed the other way 'round and remove the personal gallery section during batch-add.
As a fix for the existing release (stable branch) I think your fix should be applied (maybe with some comments in the code), but we should make up our minds for the devel branch independently imo.
Logged

Blueiris

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 170
  • Horse poor!
    • Saddlebred World Gallery
Re: Batch add to user albums, but editing reassigns to different album
« Reply #3 on: February 02, 2006, 06:25:39 pm »

Confirming that those code changes fix the problem in both cpg142 and cpg143.

GauGau, I had the same question in my mind when the problem came up. Why did they let admin batch add to personal galleries? I couldn't think of a reason why I'd want to use it on my own galleries, but one user uses it, which is how the problem was uncovered. (See http://forum.coppermine-gallery.net/index.php?topic=27225.0) If there's one, there's more, so for what it's worth, if I had a "vote" on the devel branch, I'd say leave it in.

Logged
You can lead a horse to water, but you can't make him drink - he's got to discover that it's wet for himself.

Nibbler

  • Guest
Re: Batch add to user albums, but editing reassigns to different album
« Reply #4 on: February 02, 2006, 06:36:56 pm »

If this is to be officially allowed then we'd need additional fixes for file ownership and quotas.
Logged

wprowe

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 32
    • Music, Travel, Outdoor, Nature and Wildlife Photography
Re: Batch add to user albums, but editing reassigns to different album
« Reply #5 on: February 02, 2006, 07:10:35 pm »

Hi all. I'm the Coppermine user who raised this issue. Here is the rationale for admin needing to batch add to individual user's albums.

I'm a photographer. I need to show specific images to specific clients in private albums. As far as I know, individual users cannot batch add pictures to albums. Please correct me if I am wrong and tell me where I can turn this feature one for individual users (or perhaps members of a specific group). What I do is create a client login ID, login as that ID, and create a private album viewable by only that user. I then upload the images to a private directory on my web server, login as admin and batch add to that album the directory of images I want that client to view. All photographers need this capability.

I suppose I could add passwords to albums owned by admin, and make them viewable only by registered users. However, that would require the user to know two passwords, would let any registered user see the album thumbnail, and becomes confusing for photo editors who just want to review a specific set of images with as little hassle as possible. I'm looking for simple and I think I've got it with the method I use. Plus with the method I use, the user has the ability to remove images from the album, leaving only the ones they are interested in. Think of it as an online light table I provide for clients.

If individual users could batch add to their own albums, that would solve my problem too. I could upload the images to a private directory on my web server, then login as the client's ID and batch add the images to their album. I just need a fast way to add lots of images to a private user's album. It doesn't have to be as admin. That is just the only way I can do it at the present.

Thanks for helping out!
Logged
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Batch add to user albums, but editing reassigns to different album
« Reply #6 on: February 02, 2006, 07:23:36 pm »

@devs: So imo we should fix searchnew.php for the cpg1.4.x and remove the ability to batch-add into personal galleries and put a paragraph into the "know issues" section of the docs (I'm convinced that there's going to be a cpg1.4.4 anyway).
Actually allowing the admin to batch-add into the personal galleries would be a new feature that should carefully be inspected and maybe added to cpg1.5.x (of at all).

@wprowe: you're using batch-add for something coppermine wasn't designed to be used for. Please be patient during the discussion about a potential fix. I can understand that you want this solved asap, but I suggest you look into another method first to accomplish what you're up to (e.g. album passwords).
Logged

wprowe

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 32
    • Music, Travel, Outdoor, Nature and Wildlife Photography
Re: Batch add to user albums, but editing reassigns to different album
« Reply #7 on: February 02, 2006, 07:33:46 pm »

Thanks GauGau. Much appreciate you all looking at this. I'm a former "Gallery" user and much prefer Coppermine. I'm all too happy to contribute to its evolution through input as a business owner with requirements that I can articulate. Like I said, I just want to be able to add lots of images quickly to a private user's albums. Batch add serves that purpose. I would gladly do it as the user instead of admin if it were available to individual users.

By the way, I tested the above patch on my installation and it resolves the problem at hand until you determine how you want to do this in the future.

Thanks all!
« Last Edit: February 02, 2006, 08:18:33 pm by wprowe »
Logged
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

Blueiris

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 170
  • Horse poor!
    • Saddlebred World Gallery
Re: Batch add to user albums, but editing reassigns to different album
« Reply #8 on: February 02, 2006, 08:26:04 pm »

@Nibbler: Another disadvantage to allowing this is that it creates a divergence from the standard cpg directory tree for user files. The files stay in the directory the admin set up for ftp uploads. I'm not sure how much of a difference that would make overall, but you then have a situation where some of the files in a user album are in the standard userpics directory tree, while others are in a folder outside of that tree.

Yes, these files do stay under the ownership of the admin in the database after adding them to a user album and don't seem to affect the user's quota. However the user that owns the album has full control over the files, and can move them to another of his/her albums, delete them, etc.

@wprowe: I now have a better understanding of how you are using cpg, and I understand your points. However, for now, the fixes that Abbas Ali posted resolve your original problem with your mod for cpg142 and cpg143, so you should be able to do everything you want in those two versions.

@devs: For future versions, I'm wondering if this might be better done as a mod or plugin for those that need it, rather than included in the main code? GauGau makes a good point about using it for something it wasn't designed for, but on the other hand, one of the wonderful things about Coppermine is it's flexibility.



 



Logged
You can lead a horse to water, but you can't make him drink - he's got to discover that it's wet for himself.

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Batch add to user albums, but editing reassigns to different album
« Reply #9 on: February 03, 2006, 01:45:04 pm »

I also think that batch add in user's album should not be allowed (atleast for 1.4.x). Though admin will be able to batch add to his personal gallery album.

Should i fix this and commit to stable and devel?
Logged
Chief Geek at Ranium Systems

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Batch add to user albums, but editing reassigns to different album
« Reply #10 on: February 03, 2006, 05:09:38 pm »

yes please
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Batch add to user albums, but editing reassigns to different album
« Reply #11 on: February 04, 2006, 07:15:25 am »

Done. Added a new function get_batch_add_album_list to get the album list on searchnew since the old album list function was called from 2-3 other places too.

Committed to stable and devel.


Abbas
Logged
Chief Geek at Ranium Systems

wprowe

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 32
    • Music, Travel, Outdoor, Nature and Wildlife Photography
Re: Batch add to user albums, but editing reassigns to different album
« Reply #12 on: February 07, 2006, 06:49:00 pm »

What about making batch add in user albums a group permissions parameter, or allowing admin to enable/disable the feature in the configuration panel?
Logged
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Batch add to user albums, but editing reassigns to different album
« Reply #13 on: February 08, 2006, 09:44:38 am »

that's not the point. Allowing this would require recoding in many places - we're shying away from it, at least most definitely for cpg1.4.x, as it has already been released and no new features will be added. There may (or may not) be such an option in cpg1.5.x, but not in cpg1.4.x.
Logged

wprowe

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 32
    • Music, Travel, Outdoor, Nature and Wildlife Photography
Re: Batch add to user albums, but editing reassigns to different album
« Reply #14 on: February 21, 2006, 10:56:36 pm »

that's not the point. Allowing this would require recoding in many places - we're shying away from it, at least most definitely for cpg1.4.x, as it has already been released and no new features will be added. There may (or may not) be such an option in cpg1.5.x, but not in cpg1.4.x.

Makes sense. Thanks.

I'd like to lobby for supporting users being able to perform batch-add in 1.5x with requisite permission as has been discussed here (group permission or config panel enable/disable). Specifically, this is what photographers need to do for their clients - create private photo albums that only the client can see. To that end, this is how Coppermine can support us.

  • Create a client login ID
  • Log in as that ID
  • Create a photo album from the client's shoot
  • Batch add the photo shoot proofs to the album
  • Provide the client with the login ID and password

We like to set up private albums for clients to view proofs. Batch add as the client user ID is the easiest and most secure way to do this. It is too time consuming to add a few images at a time. We may show the client hundreds of images if necessary.

In case someone suggests this, we can't use password protected albums. Setting up album passwords requires the client to know two passwords, and/or requires the album thumbnails to be visible to other clients. This is not acceptable.
Logged
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

scuriza

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Batch add to user albums, but editing reassigns to different album
« Reply #15 on: February 28, 2006, 09:49:02 pm »

Done. Added a new function get_batch_add_album_list to get the album list on searchnew since the old album list function was called from 2-3 other places too.

Committed to stable and devel.


Abbas

Well,
I just upgrade from my version 1.42 to 1.44 of coppermine and I get an error in this function, when I try batch add files.
I try re-upload the new version and the files are listeds, but the system can not create thumbs and insert the pictures in a album.



Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Batch add to user albums, but editing reassigns to different album
« Reply #16 on: March 01, 2006, 08:19:14 am »

don't reply to a bug thread. If you have issues with uploads, post your own thread on the corresponding support board after having read the docs, particularly the upload troubleshooting section. Locking this thread now.
Logged
Pages: [1]   Go Up
 

Page created in 0.034 seconds with 19 queries.