Skip to content

Commit

Permalink
pkp#10480 Missing userRoles argument to inizialize submission schema …
Browse files Browse the repository at this point in the history
…mapping
  • Loading branch information
Vitaliy-1 committed Jan 16, 2025
1 parent 72db9ed commit 0bf3da6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion api/v1/submissions/PKPSubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
10 changes: 6 additions & 4 deletions pages/submission/PKPSubmissionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand All @@ -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()),
Expand All @@ -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()])
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 0bf3da6

Please sign in to comment.