Skip to content

Commit

Permalink
优化任务查看权限
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Dec 12, 2021
1 parent 66b5e5d commit 28dc314
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/Models/ProjectTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ public function pushMsg($action, $data = null, $userid = null)
}

/**
* 根据会员ID获取任务、项目信息(用于判断会员是否存在项目内
* 根据会员ID获取任务、项目信息(会员有任务权限 或 会员存在项目内
* @param int $task_id
* @param array $with
* @param bool $ignoreArchived 排除已归档
Expand All @@ -753,7 +753,14 @@ public static function userTask($task_id, $with = [], $ignoreArchived = true, &$
throw new ApiException('任务不存在');
}
//
$project = Project::userProject($task->project_id, $ignoreArchived);
if (ProjectTaskUser::whereUserid(User::userid())->whereTaskPid($task->id)->exists()) {
$project = Project::find($task->project_id);
if (empty($project)) {
throw new ApiException('项目不存在或已被删除');
}
} else {
$project = Project::userProject($task->project_id, $ignoreArchived);
}
//
return $task;
}
Expand Down

0 comments on commit 28dc314

Please sign in to comment.