Shared Template Incident- Prevent from delete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 04:38 AM
Hi
I have create templates for incidents and shared them.
People that I shared them those template can delete them.
I dont want that people can delete what I shared to them .
How can I prevent delete template.
Thank you.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 04:45 AM
Hi @Sheh ,
You can accomplish this by implementing a system of permissions and roles for your users. The user who creates the template would be assigned a "creator" role, which would grant them the ability to delete the template. When the template is shared with other groups or users, they would be assigned a "viewer" role, which would not include the ability to delete the template. The specific implementation of this system would depend on the technology stack you are using, but many programming languages and frameworks have built-in support for permissions and roles.
So,
1. When a user creates a template, assign them as the owner of that template. This ownership information should be stored in your database or template management system.
2. When the template is shared with other users or groups, grant them the "viewer" role for that template. This role will allow them to view and use the template but not delete it.
3. Modify the delete functionality to check if the current user requesting deletion is the owner of the template. If they are, allow the deletion to proceed. If not, display an error message indicating that only the template owner has permission to delete it.
By following this approach, each template will have a single owner who can delete it, regardless of whether it is shared with other users or groups.