diff --git a/app/Helper/ProjectRoleHelper.php b/app/Helper/ProjectRoleHelper.php index 87f7fed2d..5c80d42b3 100644 --- a/app/Helper/ProjectRoleHelper.php +++ b/app/Helper/ProjectRoleHelper.php @@ -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; + } } diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index 7815b334d..d91f84284 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index d86cd9ff0..35668d119 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 4116e4423..af011f955 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 4e1050de6..d22fc64ec 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 703167418..3e06c22f7 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index af17522c2..cef9030a7 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 53150c645..cffaa0c36 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 2de18abf0..b428ec10f 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1276,4 +1276,5 @@ return array( 'Do you really want to remove this project restriction: "%s"?' => 'Voulez-vous vraiment supprimer cette restriction de projet : « %s » ?', 'Duplicate to multiple projects' => 'Dupliquer vers plusieurs projets', 'This field is required' => 'Ce champ est requis', + 'Moving a task is not permitted' => 'Déplaçer une tâche n\'est pas autorisé', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index 124f31ef9..bd8714eb0 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index ecbc5bf70..78b465ab9 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 98485ceba..0cd91de1c 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 643c29b50..015868d8c 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index c403a3f33..00407b413 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index 85fd07e3b..944bc800e 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index 203cfcd66..c81dde89e 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index d53956e0a..4a98592a4 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 1c9544a34..6ebd1683a 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 5d7f3eeea..322f091d5 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index 707ed694f..655285b90 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1275,4 +1275,5 @@ return array( 'Do you really want to remove this project restriction: "%s"?' => 'Tem a certeza que quer remover a restrição de projeto: "%s"?', 'Duplicate to multiple projects' => 'Duplicar para vários projetos', 'This field is required' => 'Este campo é obrigatório', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 60ba63ca7..36096aed1 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index 5aa5c20ff..ac7e581b8 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 055586019..3ed3d61f1 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index e45d39f0c..6e9cc690e 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 1cc8389ea..79d038222 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index f2e75f3cd..4a7e6c5b4 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1275,4 +1275,5 @@ return array( // 'Do you really want to remove this project restriction: "%s"?' => '', // 'Duplicate to multiple projects' => '', // 'This field is required' => '', + // 'Moving a task is not permitted' => '', ); diff --git a/app/Model/ProjectRoleRestrictionModel.php b/app/Model/ProjectRoleRestrictionModel.php index dc8abf793..8ccdcf9ca 100644 --- a/app/Model/ProjectRoleRestrictionModel.php +++ b/app/Model/ProjectRoleRestrictionModel.php @@ -16,6 +16,7 @@ class ProjectRoleRestrictionModel extends Base const RULE_TASK_CREATION = 'task_creation'; const RULE_TASK_OPEN_CLOSE = 'task_open_close'; + const RULE_TASK_MOVE = 'task_move'; /** * Get rules @@ -27,6 +28,7 @@ class ProjectRoleRestrictionModel extends Base return array( self::RULE_TASK_CREATION => t('Task creation is not permitted'), self::RULE_TASK_OPEN_CLOSE => t('Closing or opening a task is not permitted'), + self::RULE_TASK_MOVE => t('Moving a task is not permitted'), ); } diff --git a/tests/units/Model/ProjectRoleRestrictionModelTest.php b/tests/units/Model/ProjectRoleRestrictionModelTest.php index 07473061c..af0f9bf9f 100644 --- a/tests/units/Model/ProjectRoleRestrictionModelTest.php +++ b/tests/units/Model/ProjectRoleRestrictionModelTest.php @@ -90,7 +90,7 @@ class ProjectRoleRestrictionModelTest extends Base $projectRoleRestrictionModel = new ProjectRoleRestrictionModel($this->container); $rules = $projectRoleRestrictionModel->getRules(); - $this->assertCount(2, $rules); + $this->assertCount(3, $rules); $this->assertArrayHasKey(ProjectRoleRestrictionModel::RULE_TASK_OPEN_CLOSE, $rules); } }