@@ -664,8 +664,33 @@ public function add(Request $illuminateRequest): JsonResponse
664
664
: $ submitAsUserGroup ->permitMetadataEdit
665
665
);
666
666
667
+ $ isSubmittingAsProductionEditor = $ submitAsUserGroup ->getLocalizedData ('name ' ) === __ ('default.groups.name.productionEditor ' );
668
+ // If submitting as Production Editor, then also assign as Author to allow full access to submission stage
669
+ if ($ isSubmittingAsProductionEditor ) {
670
+ $ authorGroup = Repo::userGroup ()->getByRoleIds ([Role::ROLE_ID_AUTHOR ], $ context ->getId ())->first ();
671
+
672
+ // Assign author role to user if not already assigned
673
+ if (!$ submitterUserGroups ->contains ('roleId ' , Role::ROLE_ID_AUTHOR )) {
674
+ Repo::userGroup ()->assignUserToGroup (
675
+ $ user ->getId (),
676
+ $ authorGroup ->id
677
+ );
678
+ }
679
+
680
+ // Assign Production Editor to submission as an Author to allow access to submission stage operations
681
+ Repo::stageAssignment ()
682
+ ->build (
683
+ $ submission ->getId (),
684
+ $ authorGroup ->id ,
685
+ $ request ->getUser ()->getId (),
686
+ $ authorGroup ->recommendOnly ,
687
+ // Authors can always edit metadata before submitting
688
+ true
689
+ );
690
+ }
691
+
667
692
// Create an author record from the submitter's user account
668
- if ($ submitAsUserGroup ->roleId === Role::ROLE_ID_AUTHOR ) {
693
+ if ($ submitAsUserGroup ->roleId === Role::ROLE_ID_AUTHOR || $ isSubmittingAsProductionEditor ) {
669
694
$ author = Repo::author ()->newAuthorFromUser ($ request ->getUser (), $ submission , $ context );
670
695
$ author ->setData ('publicationId ' , $ publication ->getId ());
671
696
$ author ->setUserGroupId ($ submitAsUserGroup ->id );
0 commit comments