@@ -620,7 +620,7 @@ public function add(Request $illuminateRequest): JsonResponse
620
620
} elseif ($ submitterUserGroups ->count ()) {
621
621
$ submitAsUserGroup = $ submitterUserGroups
622
622
->sort (function (UserGroup $ a , UserGroup $ b ) {
623
- return $ a ->getRoleId () === Role::ROLE_ID_AUTHOR ? 1 : - 1 ;
623
+ return $ a ->roleId === Role::ROLE_ID_AUTHOR ? - 1 : 1 ;
624
624
})
625
625
->first ();
626
626
} else {
@@ -664,37 +664,37 @@ public function add(Request $illuminateRequest): JsonResponse
664
664
: $ submitAsUserGroup ->permitMetadataEdit
665
665
);
666
666
667
- // Production Editor group has Managerial role but is not assigned to submission stage.
667
+ // Production Editor group has Managerial role but is not assigned to submission stage.
668
668
$ isManager = $ submitAsUserGroup ->roleId === Role::ROLE_ID_MANAGER && !$ request ->getUser ()->hasRole ([Role::ROLE_ID_SITE_ADMIN ], \PKP \core \PKPApplication::SITE_CONTEXT_ID );
669
- $ stagesAssignedToGroup = $ isManager ? Repo::userGroup ()->getAssignedStagesByUserGroupId ($ context ->getId (), $ submitAsUserGroup ->id ) : collect ();
670
- $ isSubmittingAsProductionEditor = $ isManager && !$ stagesAssignedToGroup ->contains (WORKFLOW_STAGE_ID_SUBMISSION );
671
- // Temporary solution for https://github.com/pkp/pkp-lib/issues/10929
672
- // If submitting as Production Editor, then also assign as Author to allow full access to submission stage
673
- if ($ isSubmittingAsProductionEditor ) {
674
- $ authorGroup = Repo::userGroup ()->getByRoleIds ([Role::ROLE_ID_AUTHOR ], $ context ->getId ())->first ();
675
-
676
- // Assign author role to user if not already assigned
677
- if (!$ submitterUserGroups ->contains ('roleId ' , Role::ROLE_ID_AUTHOR )) {
678
- Repo::userGroup ()->assignUserToGroup (
679
- $ user ->getId (),
680
- $ authorGroup ->id
681
- );
682
- }
683
-
684
- // Assign Production Editor to submission as an Author to allow access to submission stage operations
685
- Repo::stageAssignment ()
686
- ->build (
687
- $ submission ->getId (),
688
- $ authorGroup ->id ,
689
- $ request ->getUser ()->getId (),
690
- $ authorGroup ->recommendOnly ,
691
- // Authors can always edit metadata before submitting
692
- true
693
- );
694
- }
669
+ // $stagesAssignedToGroup = $isManager ? Repo::userGroup()->getAssignedStagesByUserGroupId($context->getId(), $submitAsUserGroup->id) : collect();
670
+ // $isSubmittingAsProductionEditor = $isManager && !$stagesAssignedToGroup->contains(WORKFLOW_STAGE_ID_SUBMISSION);
671
+ // // Temporary solution for https://github.com/pkp/pkp-lib/issues/10929
672
+ // // If submitting as Production Editor, then also assign as Author to allow full access to submission stage
673
+ // if ($isSubmittingAsProductionEditor) {
674
+ // $authorGroup = Repo::userGroup()->getByRoleIds([Role::ROLE_ID_AUTHOR], $context->getId())->first();
675
+ //
676
+ // // Assign author role to user if not already assigned
677
+ // if (!$submitterUserGroups->contains('roleId', Role::ROLE_ID_AUTHOR)) {
678
+ // Repo::userGroup()->assignUserToGroup(
679
+ // $user->getId(),
680
+ // $authorGroup->id
681
+ // );
682
+ // }
683
+ //
684
+ // // Assign Production Editor to submission as an Author to allow access to submission stage operations
685
+ // Repo::stageAssignment()
686
+ // ->build(
687
+ // $submission->getId(),
688
+ // $authorGroup->id,
689
+ // $request->getUser()->getId(),
690
+ // $authorGroup->recommendOnly,
691
+ // // Authors can always edit metadata before submitting
692
+ // true
693
+ // );
694
+ // }
695
695
696
696
// Create an author record from the submitter's user account
697
- if ($ submitAsUserGroup ->roleId === Role::ROLE_ID_AUTHOR || $ isSubmittingAsProductionEditor ) {
697
+ if ($ submitAsUserGroup ->roleId === Role::ROLE_ID_AUTHOR ) {
698
698
$ author = Repo::author ()->newAuthorFromUser ($ request ->getUser (), $ submission , $ context );
699
699
$ author ->setData ('publicationId ' , $ publication ->getId ());
700
700
$ author ->setUserGroupId ($ submitAsUserGroup ->id );
0 commit comments