]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8704 rename field "users" to "userIds"
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 27 Jan 2017 20:00:38 +0000 (21:00 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 31 Jan 2017 12:53:48 +0000 (13:53 +0100)
to remove ambiguity

server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java
server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java

index fd94265c9865a5958a48439265cb777a35a815f3..73fd9863866b84c933e8e95ef63838669c7f4cd1 100644 (file)
@@ -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<String> 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(
index 493adc21f15728a50368c0cd9ef1340e7452dab6..fbf8628d64bc97769339d284f70e08c7f05e228e 100644 (file)
@@ -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())