Piwigo-Mobile icon indicating copy to clipboard operation
Piwigo-Mobile copied to clipboard

ability to delete a photo added thanks to Community

Open plegall opened this issue 6 years ago • 5 comments

Related to #205

It would be logic to give users the ability to delete the photos they uploaded.

plegall avatar Dec 18 '19 10:12 plegall

Yes, but how can the app determine if a Community user can delete a photo?

Sent with GitHawk

EddyLB avatar Dec 18 '19 22:12 EddyLB

You need to know if the current user matches the added_by field of the photo. Method pwg.images.getInfo will tell you that. Unfortunately pwg.session.getStatus does not tell you your user_id :-/ Then I also have to make sure pwg.images.delete is OK to let you delete a photo you uploaded, even if you're not an admin.

So, for now external apps can't fullfill the request. I have to work on Piwigo API first.

plegall avatar Dec 20 '19 11:12 plegall

The upcoming version of plugin Community let the user who added the photo delete it with pwg.images.delete. What's missing now is the information "is this photo added by the current user?".

I wrote earlier about making it match the added_by returned by pwg.images.getInfo but we need to know the user_id of the current user. I can implement that 2 ways:

  1. return the user_id in pwg.session.getStatus
  2. in the pwg.images.getInfo add a return field can_be_deleted and can_be_edited (which may depend on a setting in Community)

plegall avatar Jan 31 '20 15:01 plegall

I would prefer to use the pwg.session.getStatus method which is always called at login. The app will store the user_id which will be exploited for determining whether the user can edit/delete the photo. This user_id will also be useful when the app will introduce the management of users.

EddyLB avatar Mar 22 '20 10:03 EddyLB

It would then be great to extend pwg.images.getInfo as proposed in #228 so that the app can quickly get the properties of a list of photos belonging to a user.

EddyLB avatar Apr 04 '20 13:04 EddyLB