Skip to content

pkp/pkp-lib#11389 Validate contributor user group role is author before allowing add or edit in API #11412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: stable-3_5_0
Choose a base branch
from

Conversation

Hafsa-Naeem
Copy link
Contributor

for #11389

Copy link
Contributor

@Vitaliy-1 Vitaliy-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Hafsa-Naeem!
I left comments that would require small adjustment.

$userGroup = Repo::userGroup()->get($params['userGroupId']);
if (!$userGroup || $userGroup->roleId !== Role::ROLE_ID_AUTHOR) {
return response()->json([
'userGroupId' => [__('api.submission.400.invalidUserGroup', ['userGroupId' => $params['userGroupId']])]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Localisation is needed for the error message

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, api.contributors.400.invalidUserGroup would be better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vitaliy-1 Thanks! I’ve updated the error message to use the existing localized string:
submission.upload.invalidUserGroup -> “Missing or invalid user group!”
since it’s already defined in submission.po If you’d prefer a contributor-specific message like api.contributors.400.invalidUserGroup, I can add that too, just didn’t want to introduce a new locale key unless necessary. Let me know what you prefer!

@Hafsa-Naeem Hafsa-Naeem force-pushed the i11389-stable_3_5_0_fix branch from c990a67 to 894060d Compare May 26, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants