diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-04-08 11:18:58 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-04-08 11:18:58 -0400 |
commit | fe9f3ba707d1caf9348ae17e0566eabd505fbce2 (patch) | |
tree | dff1f604fb6c9461642847c4b6684327806e0c8d /app/Helper | |
parent | 9a8c6d6493191a09720a634c58c230dba1cafeeb (diff) |
Add assignee restriction for custom project roles (dnd)
Diffstat (limited to 'app/Helper')
-rw-r--r-- | app/Helper/ProjectRoleHelper.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/Helper/ProjectRoleHelper.php b/app/Helper/ProjectRoleHelper.php index 295b8b3e..a9f0596a 100644 --- a/app/Helper/ProjectRoleHelper.php +++ b/app/Helper/ProjectRoleHelper.php @@ -36,7 +36,7 @@ class ProjectRoleHelper extends Base public function isDraggable(array &$task) { if ($task['is_active'] == 1 && $this->helper->user->hasProjectAccess('BoardAjaxController', 'save', $task['project_id'])) { - return $this->isSortableColumn($task['project_id'], $task['column_id']); + return $this->isSortableColumn($task['project_id'], $task['column_id'], $task['owner_id']); } return false; @@ -47,9 +47,10 @@ class ProjectRoleHelper extends Base * * @param int $projectId * @param int $columnId + * @param int $assigneeId * @return bool */ - public function isSortableColumn($projectId, $columnId) + public function isSortableColumn($projectId, $columnId, $assigneeId = null) { $role = $this->getProjectUserRole($projectId); @@ -58,6 +59,10 @@ class ProjectRoleHelper extends Base foreach ($sortableColumns as $column) { if ($column['src_column_id'] == $columnId || $column['dst_column_id'] == $columnId) { + if ($column['only_assigned'] == 1 && $assigneeId !== null && $assigneeId != $this->userSession->getId()) { + return false; + } + return true; } } @@ -182,7 +187,7 @@ class ProjectRoleHelper extends Base { $role = $this->getProjectUserRole($task['project_id']); - if ($this->hasRestriction($task['project_id'], $role, ProjectRoleRestrictionModel::RULE_TASK_CHANGE_ASSIGNEE)) { + if ($this->role->isCustomProjectRole($role) && $this->hasRestriction($task['project_id'], $role, ProjectRoleRestrictionModel::RULE_TASK_CHANGE_ASSIGNEE)) { return false; } @@ -200,7 +205,7 @@ class ProjectRoleHelper extends Base { $role = $this->getProjectUserRole($task['project_id']); - if ($task['owner_id'] != $this->userSession->getId() && $this->hasRestriction($task['project_id'], $role, ProjectRoleRestrictionModel::RULE_TASK_UPDATE_ASSIGNED)) { + if ($this->role->isCustomProjectRole($role) && $task['owner_id'] != $this->userSession->getId() && $this->hasRestriction($task['project_id'], $role, ProjectRoleRestrictionModel::RULE_TASK_UPDATE_ASSIGNED)) { return false; } |