From 235e63b26efcece01468d95333fcddba3ceb2894 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 27 Jan 2017 21:00:38 +0100 Subject: [PATCH] SONAR-8704 rename field "users" to "userIds" to remove ambiguity --- .../permission/index/AuthorizationTypeSupport.java | 10 +++++----- .../server/permission/index/PermissionIndexer.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java b/server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java index fd94265c986..73fd9863866 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java @@ -40,7 +40,7 @@ public class AuthorizationTypeSupport { public static final String TYPE_AUTHORIZATION = "authorization"; public static final String FIELD_GROUP_IDS = "groupIds"; public static final String FIELD_GROUP_NAMES = "groupNames"; - public static final String FIELD_USER_LOGINS = "users"; + public static final String FIELD_USER_IDS = "userIds"; public static final String FIELD_UPDATED_AT = "updatedAt"; /** @@ -76,7 +76,7 @@ public class AuthorizationTypeSupport { authType.createDateTimeField(FIELD_UPDATED_AT); authType.createLongField(FIELD_GROUP_IDS); authType.stringFieldBuilder(FIELD_GROUP_NAMES).disableNorms().build(); - authType.stringFieldBuilder(FIELD_USER_LOGINS).disableNorms().build(); + authType.createLongField(FIELD_USER_IDS); authType.createBooleanField(FIELD_ALLOW_ANYONE); authType.setEnableSource(false); return type; @@ -87,7 +87,7 @@ public class AuthorizationTypeSupport { * user has read access. */ public QueryBuilder createQueryFilter() { - Integer userLogin = userSession.getUserId(); + Integer userId = userSession.getUserId(); Set userGroupNames = userSession.getUserGroups(); BoolQueryBuilder filter = boolQuery(); @@ -95,9 +95,9 @@ public class AuthorizationTypeSupport { filter.should(QueryBuilders.termQuery(FIELD_ALLOW_ANYONE, true)); // users - Optional.ofNullable(userLogin) + Optional.ofNullable(userId) .map(Integer::longValue) - .ifPresent(userId -> filter.should(termQuery(FIELD_USER_LOGINS, userId))); + .ifPresent(id -> filter.should(termQuery(FIELD_USER_IDS, id))); // groups userGroupNames.forEach( diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java index 493adc21f15..fbf8628d64b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java @@ -183,7 +183,7 @@ public class PermissionIndexer implements ProjectIndexer, Startable { doc.put(AuthorizationTypeSupport.FIELD_ALLOW_ANYONE, false); doc.put(AuthorizationTypeSupport.FIELD_GROUP_IDS, dto.getGroupIds()); doc.put(AuthorizationTypeSupport.FIELD_GROUP_NAMES, dto.getGroupNames()); - doc.put(AuthorizationTypeSupport.FIELD_USER_LOGINS, dto.getUsers()); + doc.put(AuthorizationTypeSupport.FIELD_USER_IDS, dto.getUsers()); } return new IndexRequest(indexName, TYPE_AUTHORIZATION, dto.getProjectUuid()) .routing(dto.getProjectUuid()) -- 2.39.5