Regular users can remove only their own tasks
This commit is contained in:
@@ -31,6 +31,7 @@ use Model\LastLogin;
|
||||
* @property \Model\Task $task
|
||||
* @property \Model\TaskHistory $taskHistory
|
||||
* @property \Model\TaskExport $taskExport
|
||||
* @property \Model\TaskPermission $taskPermission
|
||||
* @property \Model\TaskValidator $taskValidator
|
||||
* @property \Model\CommentHistory $commentHistory
|
||||
* @property \Model\SubtaskHistory $subtaskHistory
|
||||
@@ -242,6 +243,10 @@ abstract class Base
|
||||
*/
|
||||
protected function taskLayout($template, array $params)
|
||||
{
|
||||
if (isset($params['task']) && $this->taskPermission->canRemoveTask($params['task']) === false) {
|
||||
$params['hide_remove_menu'] = true;
|
||||
}
|
||||
|
||||
$content = $this->template->load($template, $params);
|
||||
$params['task_content_for_layout'] = $content;
|
||||
|
||||
|
||||
@@ -289,6 +289,10 @@ class Task extends Base
|
||||
{
|
||||
$task = $this->getTask();
|
||||
|
||||
if (! $this->taskPermission->canRemoveTask($task)) {
|
||||
$this->forbidden();
|
||||
}
|
||||
|
||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
||||
|
||||
$this->checkCSRFParam();
|
||||
|
||||
Reference in New Issue
Block a user