User "Remove" Permissions for Task

Is there anyway to currently prevent a user from having the remove permissions for their own tasks?

It wasn’t something that had come up as a requirement until today but the need has come up to potentially prevent users from being able to remove tasks from the board. We tested with a user that has “Project Member” permissions for the project and that user couldn’t Remove a task I had created but they could Remove one they had created and this is the scenario the department would like to prevent.

It wouldn’t be as much of an issue if the Remove action led to a soft delete, but it currently leads to a hard delete so once it’s gone, the record is removed from the database and the concern here is that one of the staff members on the team might remove their own records they create in the future and impact their teammates negatively that way by removing important / useful information that’s been recorded in Kanboard.

@orware

Out of the box, no.

But…you could make a plugin that would block the TaskSuppressionController from being accessed by anyone below Project Managers, or admin, or whatever you want.

So, The answer is yes, you can.

All you need to do is add:
$this->projectAccessMap->add('TaskSuppressionController', 'remove', Role::PROJECT_MANAGER);
to the initialize() method in your Plugin.php, with correct use's.

This would Block access to the remove method in that controller. It would however not remove the link to “remove” in the dropdown, but if they tried to “remove” it would spin and spin until they hit cancel. You could override the template for the dropdowns and conditionally hide the option to remove as well, but not worth the time in my opinion, because, regardless, they won’t be able to remove anything.

If you can’t figure that out, let me know, I could probably write that in 5mins for you.

@orware

Like this.

1 Like

Thanks @creecros. The only part there that sounds a little bit bad from the user perspective is how the option will still be displayed to the regular Project Users but at least it handles the requirement :-).

Thank you, I’ll give the plugin you created a try today!

@orware

It would be just as easy to also hide the option from them. My aim was to give you the bricks, not to build the whole wall. :wink:

However, if you desire that, and can’t figure out the rest, I would be happy to help. :tongue:

Here is another brick for you: