From 0bf3da63c6482bba9b8bd005d5ac9f9b13184af5 Mon Sep 17 00:00:00 2001 From: Vitalii Bezsheiko Date: Fri, 17 Jan 2025 01:07:16 +0200 Subject: [PATCH] pkp/pkp-lib#10480 Missing userRoles argument to inizialize submission schema mapping --- api/v1/submissions/PKPSubmissionController.php | 4 +++- pages/submission/PKPSubmissionHandler.php | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/api/v1/submissions/PKPSubmissionController.php b/api/v1/submissions/PKPSubmissionController.php index 0183f791590..6cd25f0a3f6 100644 --- a/api/v1/submissions/PKPSubmissionController.php +++ b/api/v1/submissions/PKPSubmissionController.php @@ -682,7 +682,9 @@ public function add(Request $illuminateRequest): JsonResponse $userGroups = $userGroups->lazy(); } - return response()->json(Repo::submission()->getSchemaMap()->map($submission, $userGroups, $genres), Response::HTTP_OK); + $userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES); + + return response()->json(Repo::submission()->getSchemaMap()->map($submission, $userGroups, $genres, $userRoles), Response::HTTP_OK); } /** diff --git a/pages/submission/PKPSubmissionHandler.php b/pages/submission/PKPSubmissionHandler.php index cc4dc7b9947..c8d0e84fd87 100644 --- a/pages/submission/PKPSubmissionHandler.php +++ b/pages/submission/PKPSubmissionHandler.php @@ -220,6 +220,8 @@ protected function showWizard(array $args, Request $request, Submission $submiss $templateMgr = TemplateManager::getManager($request); + $userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES); + $templateMgr->setState([ 'categories' => Repo::category()->getBreadcrumbs($categories), 'components' => [ @@ -241,7 +243,7 @@ protected function showWizard(array $args, Request $request, Submission $submiss 'publicationApiUrl' => $this->getPublicationApiUrl($request, $submission->getId(), $publication->getId()), 'reconfigurePublicationProps' => $this->getReconfigurePublicationProps(), 'reconfigureSubmissionProps' => $this->getReconfigureSubmissionProps(), - 'submission' => Repo::submission()->getSchemaMap()->map($submission, $userGroups, $genres), + 'submission' => Repo::submission()->getSchemaMap()->map($submission, $userGroups, $genres, $userRoles), 'submissionApiUrl' => Repo::submission()->getUrlApi($request->getContext(), $submission->getId()), 'submissionSavedUrl' => $this->getSubmissionSavedUrl($request, $submission->getId()), 'submissionWizardUrl' => Repo::submission()->getUrlSubmissionWizard($context, $submission->getId()), @@ -266,9 +268,9 @@ protected function showWizard(array $args, Request $request, Submission $submiss if (!$isAdmin) { $authorUserGroupIds = UserGroup::withContextIds([$submission->getData('contextId')]) - ->withRoleIds([Role::ROLE_ID_AUTHOR]) + ->withRoleIds([Role::ROLE_ID_AUTHOR]) ->get() - ->map(fn($userGroup) => $userGroup->id) + ->map(fn ($userGroup) => $userGroup->id) ->toArray(); $stageAssignments = StageAssignment::withSubmissionIds([$submission->getId()]) @@ -321,7 +323,7 @@ public function cancelled(array $args, Request $request): void $templateMgr = TemplateManager::getManager($request); $templateMgr->assign([ - 'pageTitle' => __('submission.wizard.submissionCancelled'), + 'pageTitle' => __('submission.wizard.submissionCancelled'), 'pageWidth' => TemplateManager::PAGE_WIDTH_NARROW, ]); $templateMgr->display('submission/cancelled.tpl');