Piwigo: some sanity checks before adding to collection as per Elrond's suggestions.
authorMats Sjöberg <mats@sjoberg.fi>
Tue, 21 May 2013 19:46:57 +0000 (22:46 +0300)
committerMats Sjöberg <mats@sjoberg.fi>
Tue, 21 May 2013 19:46:57 +0000 (22:46 +0300)
mediagoblin/plugins/piwigo/views.py

index 250bf758458b0117223141d470300fa5e2440862..5285ce655b40cd1a71e2766dd19bfe2d83205a09 100644 (file)
@@ -179,7 +179,8 @@ def pwg_images_addSimple(request):
     collection_id = form.category.data
     if collection_id > 0:
         collection = Collection.query.get(collection_id)
-        add_media_to_collection(collection, entry, "")
+        if collection is not None and collection.creator == request.user.id:
+            add_media_to_collection(collection, entry, "")
 
     return {'image_id': entry.id, 'url': entry.url_for_self(request.urlgen,
                                                             qualified=True)}