-
Notifications
You must be signed in to change notification settings - Fork 468
Open
Labels
Bug:0:TrivialA bug mainly used for UI bugs that do not affect common functionality but break user experience.A bug mainly used for UI bugs that do not affect common functionality but break user experience.
Milestone
Description
The function UserGroup::scopeWithUserUserGroupStatus does not consider the user ID -- e.g. if the user has an active role. There is no relationship to the user there.
S. https://github.com/pkp/pkp-lib/blob/stable-3_5_0/pages/submission/PKPSubmissionHandler.php#L620-L624
which leads to this SQL:
SELECT *
FROM "user_groups"
WHERE "context_id" IN (1)
AND EXISTS (
SELECT *
FROM "user_user_groups"
WHERE "user_groups"."user_group_id" = "user_user_groups"."user_group_id"
AND "user_id" IN (21)
)
AND EXISTS (
SELECT *
FROM "user_group_stage"
WHERE "user_groups"."user_group_id" = "user_group_stage"."user_group_id"
AND "stage_id" IN (1)
)
AND EXISTS (
SELECT *
FROM "user_user_groups"
WHERE "user_groups"."user_group_id" = "user_user_groups"."user_group_id"
AND (
"date_start" <= '2025-11-10T18:44:51.030404Z'
OR "date_start" IS NULL
)
AND (
"date_end" > '2025-11-10T18:44:51.030404Z'
OR "date_end" IS NULL
)
);
This function will be removed and instead of this function this pattern should be used:
$userGroups = UserGroup::query()
->withContextIds([$context->getId()])
->whereHas('userUserGroups', function (Builder $query) use ($user) {
$query->withUserId($user->getId())->withActive();
})
->get();
Also, the function Repo::userGroup()::userUserGroups(), that also needs to be fixed, can be used for the same purpose.
AC to test this
- Test if there exists author roles in journal a new roleless user can still create a new submission and be granted author role after privacy step.
Previously to the fix, if there are no other users with an author role then a ghost author role is given to the first user to create a new submission but any other user without author role would not be able to complete a new submission. Any user should be able to add a new submission even if they don't have the author role. It will be given to them after the privacy consent step is completed.
PRs:
stable-3_5_0:
- pkp/pkp-lib#12017 fix getting user active roles, consider only active users at some places in the code #12018
- pkp/pkp-lib#12017 submodule udpate ojs#5175 (only submodule update)
- pkp/pkp-lib#12017 submodule udpate omp#2165 (only submodule update)
- pkp/pkp-lib#12017 submodule udpate ops#1135 (only submodule update)
main:
Metadata
Metadata
Assignees
Labels
Bug:0:TrivialA bug mainly used for UI bugs that do not affect common functionality but break user experience.A bug mainly used for UI bugs that do not affect common functionality but break user experience.