Add project restriction for opening/closing tasks
This commit is contained in:
parent
0e055eabe1
commit
4bc83646b0
|
|
@ -13,11 +13,16 @@ use Kanboard\Core\Base;
|
|||
class ProjectRoleRestrictionModel extends Base
|
||||
{
|
||||
const TABLE = 'project_role_has_restrictions';
|
||||
const RULE_TASK_CREATION = 'task_creation';
|
||||
|
||||
const RULE_TASK_CREATION = 'task_creation';
|
||||
const RULE_TASK_OPEN_CLOSE = 'task_open_close';
|
||||
|
||||
protected $ruleMapping = array(
|
||||
self::RULE_TASK_CREATION => array(
|
||||
array('controller' => 'TaskCreationController', 'method' => '*'),
|
||||
),
|
||||
self::RULE_TASK_OPEN_CLOSE => array(
|
||||
array('controller' => 'TaskStatusController', 'method' => '*'),
|
||||
)
|
||||
);
|
||||
|
||||
|
|
@ -29,7 +34,8 @@ class ProjectRoleRestrictionModel extends Base
|
|||
public function getRules()
|
||||
{
|
||||
return array(
|
||||
self::RULE_TASK_CREATION => t('Task creation is not permitted'),
|
||||
self::RULE_TASK_CREATION => t('Task creation is not permitted'),
|
||||
self::RULE_TASK_OPEN_CLOSE => t('Closing or opening a task is not permitted'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
<?= $this->url->link(t('Remove'), 'TaskSuppressionController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if (isset($task['is_active'])): ?>
|
||||
<?php if (isset($task['is_active']) && $this->user->hasProjectAccess('TaskStatusController', 'close', $task['project_id'])): ?>
|
||||
<li>
|
||||
<?php if ($task['is_active'] == 1): ?>
|
||||
<i class="fa fa-times fa-fw"></i>
|
||||
|
|
|
|||
|
|
@ -78,20 +78,22 @@
|
|||
<i class="fa fa-clone fa-fw"></i>
|
||||
<?= $this->url->link(t('Move to another project'), 'TaskDuplicationController', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<?php if ($task['is_active'] == 1): ?>
|
||||
<li>
|
||||
<i class="fa fa-arrows fa-fw"></i>
|
||||
<?= $this->url->link(t('Move position'), 'TaskMovePositionController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<li>
|
||||
<i class="fa fa-times fa-fw"></i>
|
||||
<?= $this->url->link(t('Close this task'), 'TaskStatusController', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li>
|
||||
<i class="fa fa-check-square-o fa-fw"></i>
|
||||
<?= $this->url->link(t('Open this task'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<?php if ($this->user->hasProjectAccess('TaskStatusController', 'close', $task['project_id'])): ?>
|
||||
<?php if ($task['is_active'] == 1): ?>
|
||||
<li>
|
||||
<i class="fa fa-arrows fa-fw"></i>
|
||||
<?= $this->url->link(t('Move position'), 'TaskMovePositionController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<li>
|
||||
<i class="fa fa-times fa-fw"></i>
|
||||
<?= $this->url->link(t('Close this task'), 'TaskStatusController', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li>
|
||||
<i class="fa fa-check-square-o fa-fw"></i>
|
||||
<?= $this->url->link(t('Open this task'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php if ($this->projectRole->canRemoveTask($task)): ?>
|
||||
<li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue