fix: 主任务负责人无法修改子任务负责人的问题
This commit is contained in:
parent
ea87092d73
commit
b05db6d458
@ -866,6 +866,24 @@ class ProjectTask extends AbstractModel
|
||||
return $user->owner ? 2 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否负责人(或者是主任务的负责人)
|
||||
* @return bool
|
||||
*/
|
||||
public function isOwner()
|
||||
{
|
||||
if ($this->owner) {
|
||||
return true;
|
||||
}
|
||||
if ($this->parent_id > 0) {
|
||||
$mainTask = self::allData()->find($this->parent_id);
|
||||
if ($mainTask->owner) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有负责人
|
||||
* @return bool
|
||||
@ -1067,7 +1085,7 @@ class ProjectTask extends AbstractModel
|
||||
* 获取任务(会员有任务权限 或 会员存在项目内)
|
||||
* @param int $task_id
|
||||
* @param bool $archived true:仅限未归档, false:仅限已归档, null:不限制
|
||||
* @param int|bool $mustOwner 0|false:不限制, 1|true:限制任务或项目负责人, 2:已有负责人才限制任务或项目负责人
|
||||
* @param int|bool $mustOwner 0|false:不限制, 1|true:限制任务或项目负责人, 2:已有负责人才限制任务或项目负责人(子任务时如果是主任务负责人也可以)
|
||||
* @param array $with
|
||||
* @return self
|
||||
*/
|
||||
@ -1100,7 +1118,7 @@ class ProjectTask extends AbstractModel
|
||||
if ($mustOwner === 2) {
|
||||
$mustOwner = $task->hasOwner() ? 1 : 0;
|
||||
}
|
||||
if (($mustOwner === 1 || $mustOwner === true) && !$task->owner && !$project->owner) {
|
||||
if (($mustOwner === 1 || $mustOwner === true) && !$task->isOwner() && !$project->owner) {
|
||||
throw new ApiException('仅限项目或任务负责人操作');
|
||||
}
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user