diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-09-11 18:32:47 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-09-11 18:32:47 -0400 |
commit | c84df535b6bdc7260144872fc4e0c241a5a5ad61 (patch) | |
tree | d0e1dfe683fc338298f64e67e69cbbb26455e08c /app/Model | |
parent | d8f6d8568396816a6bfaca1e01211384e803cf91 (diff) |
Improve column restrictions
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/ColumnMoveRestrictionModel.php | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/app/Model/ColumnMoveRestrictionModel.php b/app/Model/ColumnMoveRestrictionModel.php index 27c9afab..c2603efd 100644 --- a/app/Model/ColumnMoveRestrictionModel.php +++ b/app/Model/ColumnMoveRestrictionModel.php @@ -15,26 +15,6 @@ class ColumnMoveRestrictionModel extends Base const TABLE = 'column_has_move_restrictions'; /** - * Check if the custom project role is allowed to move a task - * - * @param int $project_id - * @param string $role - * @param int $src_column_id - * @param int $dst_column_id - * @return int - */ - public function isAllowed($project_id, $role, $src_column_id, $dst_column_id) - { - return $this->db->table(self::TABLE) - ->left(ProjectRoleModel::TABLE, 'pr', 'role_id', self::TABLE, 'role_id') - ->eq(self::TABLE.'.project_id', $project_id) - ->eq(self::TABLE.'.src_column_id', $src_column_id) - ->eq(self::TABLE.'.dst_column_id', $dst_column_id) - ->eq('pr.role', $role) - ->exists(); - } - - /** * Fetch one restriction * * @param int $project_id @@ -91,20 +71,21 @@ class ColumnMoveRestrictionModel extends Base } /** - * Get all source column Ids + * Get all sortable column Ids * * @param int $project_id * @param string $role * @return array */ - public function getAllSrcColumns($project_id, $role) + public function getSortableColumns($project_id, $role) { return $this->db - ->hashtable(self::TABLE) + ->table(self::TABLE) + ->columns(self::TABLE.'.src_column_id', self::TABLE.'.dst_column_id') ->left(ProjectRoleModel::TABLE, 'pr', 'role_id', self::TABLE, 'role_id') ->eq(self::TABLE.'.project_id', $project_id) ->eq('pr.role', $role) - ->getAll('src_column_id', 'src_column_id'); + ->findAll(); } /** |