Skip to content

Commit 9bad3a4

Browse files
committed
pkp#10929 "Exclude user groups without submission stage access from 'submit as' options"
1 parent d637aeb commit 9bad3a4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

classes/components/forms/submission/StartSubmission.php

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use PKP\components\forms\FormComponent;
2424
use PKP\config\Config;
2525
use PKP\context\Context;
26+
use PKP\facades\Repo;
2627
use PKP\security\Role;
2728
use PKP\userGroup\UserGroup;
2829

@@ -152,6 +153,17 @@ protected function addSubmissionChecklist(Context $context): void
152153
*/
153154
protected function addUserGroups(Enumerable $userGroups): void
154155
{
156+
$groupsWithAccessToSubmissionStage = Repo::userGroup()->getUserGroupsByStage($this->context->getId(), WORKFLOW_STAGE_ID_SUBMISSION)
157+
->pluck('user_group_id')
158+
->toArray();
159+
160+
// There isn't a submission stage in OPS, so $groupsWithAccessToSubmissionStage will be empty there.
161+
// For other apps, filter $userGroups to be only those with access to submission stage
162+
if (!empty($groupsWithAccessToSubmissionStage)) {
163+
$userGroups = $userGroups->filter(function (UserGroup $userGroup) use ($groupsWithAccessToSubmissionStage) {
164+
return in_array($userGroup->id, $groupsWithAccessToSubmissionStage);
165+
});
166+
}
155167
if ($userGroups->count() < 2) {
156168
return;
157169
}

0 commit comments

Comments
 (0)