diff --git a/classes/submission/maps/Schema.php b/classes/submission/maps/Schema.php index 1e5c21452fb..0924f1915f1 100644 --- a/classes/submission/maps/Schema.php +++ b/classes/submission/maps/Schema.php @@ -527,9 +527,17 @@ public function getPropertyStages(Submission $submission): array $currentUserAssignedRoles = []; $stageAssignmentsOverview = []; if ($currentUser) { + // FIXME - $stageAssignments are just temporarly added until https://github.com/pkp/pkp-lib/issues/10480 is ready + $currentRoles = array_map( + function (Role $role) { + return $role->getId(); + }, + $currentUser->getRoles($this->context->getId()) + ); // Replaces StageAssignmentDAO::getBySubmissionAndUserIdAndStageId $stageAssignments = StageAssignment::withSubmissionIds([$submission->getId()]) ->withUserId($currentUser->getId() ?? 0) + ->withStageIds([$stageId]) ->get(); foreach ($stageAssignments as $stageAssignment) { @@ -544,6 +552,7 @@ public function getPropertyStages(Submission $submission): array ->withStageIds([$stageId]) ->get(); + // FIXME - $stageAssignments are just temporarly added until https://github.com/pkp/pkp-lib/issues/10480 is ready foreach ($stageAssignments as $stageAssignment) { $userGroup = Repo::userGroup()->get($stageAssignment->userGroupId); $stageAssignmentsOverview[] = [ @@ -555,7 +564,13 @@ public function getPropertyStages(Submission $submission): array } } $stage['currentUserAssignedRoles'] = array_values(array_unique($currentUserAssignedRoles)); + // FIXME - $stageAssignments are just temporarly added until https://github.com/pkp/pkp-lib/issues/10480 is ready $stage['stageAssignments'] = $stageAssignmentsOverview; + if(!$stage['currentUserAssignedRoles']) { + if(in_array(Role::ROLE_ID_MANAGER, $currentRoles)) { + $stage['currentUserAssignedRoles'][] = Role::ROLE_ID_MANAGER; + } + } // Stage-specific statuses switch ($stageId) { case WORKFLOW_STAGE_ID_SUBMISSION: