diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Model/ProjectRoleRestrictionModel.php | 10 | ||||
-rw-r--r-- | app/Template/task/dropdown.php | 2 | ||||
-rw-r--r-- | app/Template/task/sidebar.php | 30 |
3 files changed, 25 insertions, 17 deletions
diff --git a/app/Model/ProjectRoleRestrictionModel.php b/app/Model/ProjectRoleRestrictionModel.php index 0411838d..7679f650 100644 --- a/app/Model/ProjectRoleRestrictionModel.php +++ b/app/Model/ProjectRoleRestrictionModel.php @@ -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'), ); } diff --git a/app/Template/task/dropdown.php b/app/Template/task/dropdown.php index 19c8316e..127fc89c 100644 --- a/app/Template/task/dropdown.php +++ b/app/Template/task/dropdown.php @@ -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> diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php index 827c2f39..87fe8cee 100644 --- a/app/Template/task/sidebar.php +++ b/app/Template/task/sidebar.php @@ -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> |