From: Simon Brandhof Date: Wed, 10 May 2017 18:47:56 +0000 (+0200) Subject: Fix bug in AuthorizationDao#keepAuthorizedProjectIds() X-Git-Tag: 6.4-RC1~58 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=507a364e04aeda658041c3794ab96667ebdf531e;p=sonarqube.git Fix bug in AuthorizationDao#keepAuthorizedProjectIds() Input of ids is not correctly partitioned. The SQL request may fail on some databases (Oracle at least) if the input list of ids is greater than 1'000 elements. --- diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java index d55f13ce0e7..06eda851274 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java @@ -124,14 +124,14 @@ public class AuthorizationDao implements Dao { return mapper(dbSession).selectOrganizationUuidsOfUserWithGlobalPermission(userId, permission); } - public Set keepAuthorizedProjectIds(DbSession dbSession, Collection componentIds, @Nullable Integer userId, String role) { + public Set keepAuthorizedProjectIds(DbSession dbSession, Collection componentIds, @Nullable Integer userId, String permission) { return executeLargeInputsIntoSet( componentIds, partition -> { if (userId == null) { - return mapper(dbSession).keepAuthorizedProjectIdsForAnonymous(role, componentIds); + return mapper(dbSession).keepAuthorizedProjectIdsForAnonymous(permission, partition); } - return mapper(dbSession).keepAuthorizedProjectIdsForUser(userId, role, componentIds); + return mapper(dbSession).keepAuthorizedProjectIdsForUser(userId, permission, partition); }); }