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
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
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
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.?
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?
Using the latest rev, you should be able to add something like:
ImageGalleryItem::$delete_permission = "CMS_ACCESS_CMSMain";
to your _config.php.
I just made this change, it works perfect, thanks!
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
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?
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.