diff --git a/classes/core/PKPApplication.php b/classes/core/PKPApplication.php index 47b9ac1d545..1445cae4496 100644 --- a/classes/core/PKPApplication.php +++ b/classes/core/PKPApplication.php @@ -598,7 +598,7 @@ public static function getRoleNames(bool $contextOnly = false, ?array $roleIds = public static function getWorkflowTypeRoles(): array { return [ - self::WORKFLOW_TYPE_EDITORIAL => [Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], + self::WORKFLOW_TYPE_EDITORIAL => [Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_AUTHOR], self::WORKFLOW_TYPE_AUTHOR => [Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_AUTHOR], ]; } diff --git a/pages/workflow/PKPWorkflowHandler.php b/pages/workflow/PKPWorkflowHandler.php index 1d35de0a7c1..ebbefec0820 100644 --- a/pages/workflow/PKPWorkflowHandler.php +++ b/pages/workflow/PKPWorkflowHandler.php @@ -132,6 +132,28 @@ public function access($args, $request) assert(isset($workingStageId)); $router = $request->getRouter(); + $user = $request->getUser(); + + // Check if the user is only author of this submission + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ + $authorUserGroupIds = Repo::userGroup()->getArrayIdByRoleId(Role::ROLE_ID_AUTHOR); + $stageAssignments = $stageAssignmentDao->getBySubmissionAndStageId($submission->getId(), null, null, $user->getId())->toArray(); + // $stageAssignments can be empty for an editor not assigned + if ( sizeof($stageAssignments) > 0) { + $authorDashboard = true; + foreach ($stageAssignments as $stageAssignment) { + // authorDashboard = false if user is not only assigned as Author + if (! in_array($stageAssignment->getUserGroupId(), $authorUserGroupIds)) { + $authorDashboard = false; + } + } + + if ( $authorDashboard ) { + $redirectUrl = Repo::submission()->getUrlAuthorWorkflow($request->getContext(), $submission->getId() ); + $request->redirectUrl($redirectUrl); + } + } + $request->redirectUrl($router->url($request, null, 'workflow', 'index', [$submission->getId(), $workingStageId])); }