WHERE
gr.resource_id=#{componentId}
AND gr.role=#{role}
- AND (gr.group_id IS NULL OR gr.group_id IN (
- select gu.group_id from groups_users gu where gu.user_id in
+ AND gu.user_id in
<foreach collection="userIds" open="(" close=")" item="id" separator=",">
#{id}
</foreach>
- ))
UNION
SELECT ur.user_id
FROM user_roles ur
// Only 100 and 101 has 'user' role on project
newHashSet(100L, 101L, 102L), "user", PROJECT_ID)).containsOnly(100L, 101L);
+ assertThat(authorization.keepAuthorizedUsersForRoleAndProject(dbTester.getSession(),
+ // Only 100 and 101 has 'user' role on project
+ newHashSet(100L), "user", PROJECT_ID)).containsOnly(100L);
+
// user does not have the role "admin"
assertThat(authorization.keepAuthorizedUsersForRoleAndProject(dbTester.getSession(), newHashSet(100L), "admin", PROJECT_ID)).isEmpty();
// Only 100 and 101 has 'user' role on project
newHashSet(100L, 101L, 102L), "user", PROJECT_ID)).containsOnly(100L, 101L);
+ assertThat(authorization.keepAuthorizedUsersForRoleAndProject(dbTester.getSession(),
+ newHashSet(100L), "user", PROJECT_ID)).containsOnly(100L);
+
// user does not have the role "admin"
assertThat(authorization.keepAuthorizedUsersForRoleAndProject(dbTester.getSession(), newHashSet(100L), "admin", PROJECT_ID)).isEmpty();