diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-05-10 20:47:56 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-05-10 23:08:31 +0200 |
commit | 507a364e04aeda658041c3794ab96667ebdf531e (patch) | |
tree | 61d701accacb1245d7b2e4a540ddce4a1d12d7ac /server/sonar-db-dao | |
parent | 10e686608dd3c963ec88dfd7968424331330d584 (diff) | |
download | sonarqube-507a364e04aeda658041c3794ab96667ebdf531e.tar.gz sonarqube-507a364e04aeda658041c3794ab96667ebdf531e.zip |
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.
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r-- | server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java | 6 |
1 files changed, 3 insertions, 3 deletions
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<Long> keepAuthorizedProjectIds(DbSession dbSession, Collection<Long> componentIds, @Nullable Integer userId, String role) { + public Set<Long> keepAuthorizedProjectIds(DbSession dbSession, Collection<Long> 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); }); } |