From 003c03a4e6a73dfa3633ba756e3647bf9d4517a5 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Fri, 7 Apr 2017 21:46:36 -0400 Subject: Add project restriction to block task edition --- app/Helper/ProjectRoleHelper.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/Helper/ProjectRoleHelper.php') diff --git a/app/Helper/ProjectRoleHelper.php b/app/Helper/ProjectRoleHelper.php index 508dc9e0..295b8b3e 100644 --- a/app/Helper/ProjectRoleHelper.php +++ b/app/Helper/ProjectRoleHelper.php @@ -189,6 +189,24 @@ class ProjectRoleHelper extends Base return true; } + /** + * Return true if the user can update a task + * + * @public + * @param array $task + * @return bool + */ + public function canUpdateTask(array $task) + { + $role = $this->getProjectUserRole($task['project_id']); + + if ($task['owner_id'] != $this->userSession->getId() && $this->hasRestriction($task['project_id'], $role, ProjectRoleRestrictionModel::RULE_TASK_UPDATE_ASSIGNED)) { + return false; + } + + return true; + } + /** * Check project access * -- cgit v1.2.3