Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a requirement to prevent all users from deleting documents of a certain document type, expect for the admin user.
My first thought was to attach an event to the ContentService.Trashing event handler to achieve this by setting args.Cancel
A Google turned up https://our.umbraco.com/forum/using-umbraco-and-getting-started/75966-contentservice-how-to-get-the-user-who-triggered-the-event that suggests e.Entity.WriterId could be used.
Unfortunately for the Trashing event this doesn't seem to work correctly. I have seen the WriterId come through as 0, even when I've triggered a deletion using a different user.
You can get the current logged in user from below link.
Now, you can check if this user has permission and if yes then only allow trashing event.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted