summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controller/ColumnMoveRestrictionController.php3
-rw-r--r--app/Helper/ProjectRoleHelper.php13
-rw-r--r--app/Model/ColumnMoveRestrictionModel.php8
-rw-r--r--app/Schema/Sqlite.php7
-rw-r--r--app/Template/column_move_restriction/create.php2
-rw-r--r--app/Template/project_role/show.php6
6 files changed, 30 insertions, 9 deletions
diff --git a/app/Controller/ColumnMoveRestrictionController.php b/app/Controller/ColumnMoveRestrictionController.php
index b12f6b77..9a75bf75 100644
--- a/app/Controller/ColumnMoveRestrictionController.php
+++ b/app/Controller/ColumnMoveRestrictionController.php
@@ -49,7 +49,8 @@ class ColumnMoveRestrictionController extends BaseController
$project['id'],
$values['role_id'],
$values['src_column_id'],
- $values['dst_column_id']
+ $values['dst_column_id'],
+ isset($values['only_assigned']) && $values['only_assigned'] == 1
);
if ($restriction_id !== false) {
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;
}
diff --git a/app/Model/ColumnMoveRestrictionModel.php b/app/Model/ColumnMoveRestrictionModel.php
index c2603efd..9d2b2842 100644
--- a/app/Model/ColumnMoveRestrictionModel.php
+++ b/app/Model/ColumnMoveRestrictionModel.php
@@ -31,6 +31,7 @@ class ColumnMoveRestrictionModel extends Base
self::TABLE.'.role_id',
self::TABLE.'.src_column_id',
self::TABLE.'.dst_column_id',
+ self::TABLE.'.only_assigned',
'pr.role',
'sc.title as src_column_title',
'dc.title as dst_column_title'
@@ -59,6 +60,7 @@ class ColumnMoveRestrictionModel extends Base
self::TABLE.'.role_id',
self::TABLE.'.src_column_id',
self::TABLE.'.dst_column_id',
+ self::TABLE.'.only_assigned',
'pr.role',
'sc.title as src_column_title',
'dc.title as dst_column_title'
@@ -81,7 +83,7 @@ class ColumnMoveRestrictionModel extends Base
{
return $this->db
->table(self::TABLE)
- ->columns(self::TABLE.'.src_column_id', self::TABLE.'.dst_column_id')
+ ->columns(self::TABLE.'.src_column_id', self::TABLE.'.dst_column_id', self::TABLE.'.only_assigned')
->left(ProjectRoleModel::TABLE, 'pr', 'role_id', self::TABLE, 'role_id')
->eq(self::TABLE.'.project_id', $project_id)
->eq('pr.role', $role)
@@ -95,9 +97,10 @@ class ColumnMoveRestrictionModel extends Base
* @param int $role_id
* @param int $src_column_id
* @param int $dst_column_id
+ * @param bool $only_assigned
* @return bool|int
*/
- public function create($project_id, $role_id, $src_column_id, $dst_column_id)
+ public function create($project_id, $role_id, $src_column_id, $dst_column_id, $only_assigned = false)
{
return $this->db
->table(self::TABLE)
@@ -106,6 +109,7 @@ class ColumnMoveRestrictionModel extends Base
'role_id' => $role_id,
'src_column_id' => $src_column_id,
'dst_column_id' => $dst_column_id,
+ 'only_assigned' => (int) $only_assigned,
));
}
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index 04a5d050..ddcff861 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -8,7 +8,12 @@ use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
use PDO;
-const VERSION = 113;
+const VERSION = 114;
+
+function version_114(PDO $pdo)
+{
+ $pdo->exec('ALTER TABLE column_has_move_restrictions ADD COLUMN only_assigned INTEGER DEFAULT 0');
+}
function version_113(PDO $pdo)
{
diff --git a/app/Template/column_move_restriction/create.php b/app/Template/column_move_restriction/create.php
index 852df971..cd9e1bf5 100644
--- a/app/Template/column_move_restriction/create.php
+++ b/app/Template/column_move_restriction/create.php
@@ -12,6 +12,8 @@
<?= $this->form->label(t('Destination column'), 'dst_column_id') ?>
<?= $this->form->select('dst_column_id', $columns, $values, $errors) ?>
+ <?= $this->form->checkbox('only_assigned', t('Only for tasks assigned to the current user'), 1, isset($values['only_assigned']) && $values['only_assigned'] == 1) ?>
+
<?= $this->modal->submitButtons() ?>
<p class="alert alert-info"><?= t('People belonging to this role will be able to move tasks only between the source and the destination column.') ?></p>
diff --git a/app/Template/project_role/show.php b/app/Template/project_role/show.php
index 5377f7bb..65c9ef11 100644
--- a/app/Template/project_role/show.php
+++ b/app/Template/project_role/show.php
@@ -80,7 +80,11 @@
<i class="fa fa-check-circle-o fa-fw" aria-hidden="true"></i>
<strong><?= $this->text->e($restriction['src_column_title']) ?> / <?= $this->text->e($restriction['dst_column_title']) ?></strong>
<i class="fa fa-arrow-right fa-fw" aria-hidden="true"></i>
- <?= t('Only moving task between those columns is permitted') ?>
+ <?php if ($restriction['only_assigned'] == 1): ?>
+ <?= t('Only moving task between those columns is permitted for tasks assigned to the current user') ?>
+ <?php else: ?>
+ <?= t('Only moving task between those columns is permitted') ?>
+ <?php endif ?>
</td>
<td>
<?= $this->modal->confirm('trash-o', t('Remove'), 'ColumnMoveRestrictionController', 'confirm', array('project_id' => $project['id'], 'restriction_id' => $restriction['restriction_id'])) ?>