7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Image Gallery Delete for Non-Admins
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 950 Views |
-
Image Gallery Delete for Non-Admins

4 May 2010 at 1:29am
Is it possible in the image gallery module to allow non administrators the ability to delete the images in the Photos tab? The icon doesn't appear for them when you roll over an image.
Thanks in advance,
Andrew -
Re: Image Gallery Delete for Non-Admins

4 May 2010 at 4:04am
Well, that's cute. Looks like 2.4 sets all the canXXX() functions to default to ADMIN perms in DataObject.php. Not sure how to handle this one. Maybe have a static class property in ImageGalleryItem for $delete_permission, $edit_permission, etc.?
-
Re: Image Gallery Delete for Non-Admins

4 May 2010 at 7:11am
Ha, that is cute! I don't want to hack the core of the module. I wonder if there is a simple way to override that default behavior?
-
Re: Image Gallery Delete for Non-Admins

4 May 2010 at 7:38am
Using the latest rev, you should be able to add something like:
ImageGalleryItem::$delete_permission = "CMS_ACCESS_CMSMain";
to your _config.php.
-
Re: Image Gallery Delete for Non-Admins

4 May 2010 at 8:07am
I just made this change, it works perfect, thanks!
-
Re: Image Gallery Delete for Non-Admins

4 June 2010 at 10:49pm
Could you change the default value of this property in ImageGalleryItem.php to this more "liberal" value?
I.e. public static $delete_permission = 'CMS_ACCESS_CMSMain';I think there are a lot of users who will stumble upon this. It is very strange to set this to ADMIN since it is only a "cosmetic" property - it just hides the delete link (trashcan icon). If you know the ID of the item you still can delete it using the direct link http://yoursite/admin/EditForm/field/GalleryItems/item/ITEM_ID/delete
Jak
-
Re: Image Gallery Delete for Non-Admins

5 June 2010 at 2:18am
That was a really weird quirk in 2.4. By default, you couldn't delete ImageGalleryItems, so I had to add a canDelete() function to them. I wasn't happy with that addition either, but don't you think CMSMain is an appropriate level of permissions for deleting from the image gallery?
-
Re: Image Gallery Delete for Non-Admins

5 June 2010 at 3:27am Last edited: 5 June 2010 3:31am
In my opinion the apropriate permission would be the one needed to delete the file and the Database Entry (i.e. the ImageGalleryItem). With CMS_ACCESS_CMSMain you are able to do this.
In the version currently in the SVN ADMIN is needed, which in my opinion is to high.
| 950 Views | ||
|
Page:
1
|
Go to Top |


