Add restriction to disable task drag and drop for a project

This commit is contained in:
Frederic Guillot
2016-10-07 08:45:18 -04:00
parent 4cc856344f
commit 096b000c59
28 changed files with 50 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ class ProjectRoleHelper extends Base
}
}
return empty($sortableColumns);
return empty($sortableColumns) && $this->isAllowedToMoveTask($project_id, $role);
}
return true;
@@ -97,7 +97,7 @@ class ProjectRoleHelper extends Base
}
}
return empty($sortableColumns);
return empty($sortableColumns) && $this->isAllowedToMoveTask($project_id, $role);
}
return true;
@@ -263,4 +263,24 @@ class ProjectRoleHelper extends Base
return true;
}
/**
* Check if the role can move task in the given project
*
* @param int $project_id
* @param string $role
* @return bool
*/
protected function isAllowedToMoveTask($project_id, $role)
{
$projectRestrictions = $this->projectRoleRestrictionCacheDecorator->getAllByRole($project_id, $role);
foreach ($projectRestrictions as $restriction) {
if ($restriction['rule'] == ProjectRoleRestrictionModel::RULE_TASK_MOVE) {
return false;
}
}
return true;
}
}