Prevents users to convert subtaks to tasks when custom role does not allow it
Fixes #5069
This commit is contained in:
parent
4c40fe1931
commit
022b106d2d
|
|
@ -26,6 +26,12 @@ class SubtaskConverterController extends BaseController
|
|||
$task = $this->getTask();
|
||||
$subtask = $this->getSubtask($task);
|
||||
|
||||
if (! $this->helper->projectRole->canCreateTaskInColumn($task['project_id'], $task['column_id'])) {
|
||||
$this->flash->failure(t('You cannot create tasks in this column.'));
|
||||
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', ['task_id' => $task['id']]));
|
||||
return;
|
||||
}
|
||||
|
||||
$task_id = $this->subtaskTaskConversionModel->convertToTask($task['project_id'], $subtask['id']);
|
||||
|
||||
if ($task_id !== false) {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@
|
|||
<li>
|
||||
<?= $this->modal->confirm('trash-o', t('Remove'), 'SubtaskController', 'confirm', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?>
|
||||
</li>
|
||||
<?php if ($this->projectRole->canCreateTaskInColumn($task['project_id'], $task['column_id'])): ?>
|
||||
<li>
|
||||
<?= $this->modal->confirm('clone', t('Convert to task'), 'SubtaskConverterController', 'show', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue