Added hasQuery param to listRolesByGroup web-service.

Rename query access.

Change-Id: Iab63af14f37045d9b34b41554f15758f1d24b0c1
diff --git a/src/main/java/de/ids_mannheim/korap/dto/QueryAccessDto.java b/src/main/java/de/ids_mannheim/korap/dto/RoleDto.java
similarity index 71%
rename from src/main/java/de/ids_mannheim/korap/dto/QueryAccessDto.java
rename to src/main/java/de/ids_mannheim/korap/dto/RoleDto.java
index f6e1173..0e16496 100644
--- a/src/main/java/de/ids_mannheim/korap/dto/QueryAccessDto.java
+++ b/src/main/java/de/ids_mannheim/korap/dto/RoleDto.java
@@ -2,12 +2,13 @@
 
 import java.util.List;
 
-import de.ids_mannheim.korap.entity.UserGroupMember;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
 import lombok.Getter;
 import lombok.Setter;
 
 /**
- * Defines the structure of query accesses, e.g. as JSON
+ * Defines the structure of query roles, e.g. as JSON
  * objects in HTTP Responses.
  * 
  * @author margaretha
@@ -15,9 +16,12 @@
  */
 @Getter
 @Setter
-public class QueryAccessDto {
+public class RoleDto {
     private int roleId;
+    private String privilege;
+    @JsonInclude(JsonInclude.Include.NON_DEFAULT)
     private int queryId;
+    @JsonInclude(JsonInclude.Include.NON_NULL)
     private String queryName;
     private int userGroupId;
     private String userGroupName;
diff --git a/src/main/java/de/ids_mannheim/korap/dto/converter/QueryAccessConverter.java b/src/main/java/de/ids_mannheim/korap/dto/converter/RoleConverter.java
similarity index 68%
rename from src/main/java/de/ids_mannheim/korap/dto/converter/QueryAccessConverter.java
rename to src/main/java/de/ids_mannheim/korap/dto/converter/RoleConverter.java
index e2445e4..08ddb8e 100644
--- a/src/main/java/de/ids_mannheim/korap/dto/converter/QueryAccessConverter.java
+++ b/src/main/java/de/ids_mannheim/korap/dto/converter/RoleConverter.java
@@ -6,7 +6,7 @@
 
 import org.springframework.stereotype.Component;
 
-import de.ids_mannheim.korap.dto.QueryAccessDto;
+import de.ids_mannheim.korap.dto.RoleDto;
 import de.ids_mannheim.korap.entity.Role;
 import de.ids_mannheim.korap.entity.UserGroupMember;
 
@@ -20,16 +20,19 @@
  *
  */
 @Component
-public class QueryAccessConverter {
+public class RoleConverter {
 
-    public List<QueryAccessDto> createRoleDto (Set<Role> roles) {
-        List<QueryAccessDto> dtos = new ArrayList<>(roles.size());
+    public List<RoleDto> createRoleDto (Set<Role> roles) {
+        List<RoleDto> dtos = new ArrayList<>(roles.size());
         for (Role role : roles) {
-            QueryAccessDto dto = new QueryAccessDto();
+            RoleDto dto = new RoleDto();
             dto.setRoleId(role.getId());
-//            dto.setCreatedBy(role.getCreatedBy());
-            dto.setQueryId(role.getQuery().getId());
-            dto.setQueryName(role.getQuery().getName());
+            dto.setPrivilege(role.getPrivilege().name());
+            
+            if (role.getQuery() != null) {
+                dto.setQueryId(role.getQuery().getId());
+                dto.setQueryName(role.getQuery().getName());
+            }
             dto.setUserGroupId(role.getUserGroup().getId());
             dto.setUserGroupName(role.getUserGroup().getName());
             List<String> members = new ArrayList<>(
diff --git a/src/main/java/de/ids_mannheim/korap/service/QueryService.java b/src/main/java/de/ids_mannheim/korap/service/QueryService.java
index cf3f70e..b9d7c3c 100644
--- a/src/main/java/de/ids_mannheim/korap/service/QueryService.java
+++ b/src/main/java/de/ids_mannheim/korap/service/QueryService.java
@@ -29,9 +29,9 @@
 import de.ids_mannheim.korap.dao.RoleDao;
 import de.ids_mannheim.korap.dao.UserGroupDao;
 import de.ids_mannheim.korap.dao.UserGroupMemberDao;
-import de.ids_mannheim.korap.dto.QueryAccessDto;
+import de.ids_mannheim.korap.dto.RoleDto;
 import de.ids_mannheim.korap.dto.QueryDto;
-import de.ids_mannheim.korap.dto.converter.QueryAccessConverter;
+import de.ids_mannheim.korap.dto.converter.RoleConverter;
 import de.ids_mannheim.korap.dto.converter.QueryConverter;
 import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.entity.Role;
@@ -97,7 +97,7 @@
     @Autowired
     private QueryConverter converter;
     @Autowired
-    private QueryAccessConverter accessConverter;
+    private RoleConverter accessConverter;
 
     private void verifyUsername (String contextUsername, String pathUsername)
             throws KustvaktException {
@@ -577,16 +577,15 @@
 //        return accessConverter.createQueryAccessDto(accessList);
 //    }
 
-    public List<QueryAccessDto> listRolesByGroup (String username,
-            String groupName) throws KustvaktException {
+    public List<RoleDto> listRolesByGroup (String username,
+            String groupName, boolean hasQuery) throws KustvaktException {
         UserGroup userGroup = userGroupService
                 .retrieveUserGroupByName(groupName);
 
         Set<Role> roles;
         if (adminDao.isAdmin(username)
                 || userGroupService.isUserGroupAdmin(username, userGroup)) {
-            //            accessList = accessDao.retrieveAllAccessByGroup(userGroup.getId());
-            roles = roleDao.retrieveRoleByGroupId(userGroup.getId(), true);
+            roles = roleDao.retrieveRoleByGroupId(userGroup.getId(), hasQuery);
 
         }
         else {
diff --git a/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java b/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
index 879963e..cb1ceda 100644
--- a/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
+++ b/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
@@ -9,7 +9,7 @@
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.constant.QueryType;
-import de.ids_mannheim.korap.dto.QueryAccessDto;
+import de.ids_mannheim.korap.dto.RoleDto;
 import de.ids_mannheim.korap.dto.QueryDto;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
@@ -27,6 +27,7 @@
 import de.ids_mannheim.korap.web.utils.ResourceFilters;
 import jakarta.ws.rs.Consumes;
 import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
 import jakarta.ws.rs.GET;
 import jakarta.ws.rs.POST;
 import jakarta.ws.rs.PUT;
@@ -413,14 +414,15 @@
      */
     @GET
     @Path("access")
-    public List<QueryAccessDto> listRoles (
-            @Context SecurityContext securityContext,
-            @QueryParam("groupName") String groupName) {
+    public List<RoleDto> listRoles (@Context SecurityContext securityContext,
+            @QueryParam("groupName") String groupName,
+            @DefaultValue("true") @QueryParam("hasQuery") boolean hasQuery) {
         TokenContext context = (TokenContext) securityContext
                 .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_ACCESS_INFO);
-            return service.listRolesByGroup(context.getUsername(), groupName);
+            return service.listRolesByGroup(context.getUsername(), groupName,
+                    hasQuery);
         }
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusAccessTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusAccessTest.java
index 08b511b..b2f7637 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusAccessTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusAccessTest.java
@@ -22,9 +22,9 @@
     private String testUser = "VirtualCorpusAccessTest";
 
     @Test
-    public void testlistAccessByNonVCAAdmin () throws KustvaktException {
+    public void testlistAccessUnauthorized () throws KustvaktException {
         createDoryGroup();
-        JsonNode node = listAccessByGroup("nemo", "dory-group");
+        JsonNode node = listRolesByGroup("nemo", "dory-group");
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
         assertEquals(node.at("/errors/0/1").asText(),
@@ -32,27 +32,6 @@
         deleteGroupByName(doryGroupName, "dory");
     }
 
-    // @Test
-    // public void testlistAccessMissingId () throws KustvaktException
-    // {
-    // Response response =
-    // target().path(API_VERSION).path("vc")
-    // .path("access")
-    // .request().header(Attributes.AUTHORIZATION,
-    // HttpAuthorizationHandler
-    // .createBasicAuthorizationHeaderValue(
-    // testUser, "pass"))
-    // .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-    // .get();
-    // String entity = response.readEntity(String.class);
-    // JsonNode node = JsonUtils.readTree(entity);
-    // assertEquals(Status.BAD_REQUEST.getStatusCode(),
-    // response.getStatus());
-    // assertEquals(StatusCodes.MISSING_PARAMETER,
-    // node.at("/errors/0/0").asInt());
-    // assertEquals("vcId", node.at("/errors/0/1").asText());
-    // }
-
     @Test
     public void testDeleteSharedVC () throws KustvaktException {
         createDoryGroup();
@@ -64,7 +43,7 @@
         String groupName = "dory-group";
         shareVCByCreator(username, vcName, groupName);
 
-        JsonNode node = listAccessByGroup(username, groupName);
+        JsonNode node = listRolesByGroup(username, groupName);
         assertEquals(1, node.size());
 //      System.out.println(node.toPrettyString());
       //        assertEquals(2, node.at("/0/queryId").asInt());
@@ -74,7 +53,7 @@
 
         // delete project VC
         deleteVC(vcName, username, username);
-        node = listAccessByGroup(username, groupName);
+        node = listRolesByGroup(username, groupName);
         assertEquals(0, node.size());
 
         deleteGroupByName(doryGroupName, "dory");
@@ -98,7 +77,7 @@
         node = retrieveVCInfo("marlin", "marlin", vcName);
         assertEquals(node.at("/type").asText(), "project");
         // list vc access by marlin
-        node = listAccessByGroup("marlin", groupName);
+        node = listRolesByGroup("marlin", groupName);
         assertEquals(1, node.size());
 
         // get access id
@@ -142,7 +121,7 @@
         Response response = deleteAccess("nemo", roleId);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        JsonNode node = listAccessByGroup("nemo", groupName);
+        JsonNode node = listRolesByGroup("nemo", groupName);
         assertEquals(0, node.size());
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusControllerAdminTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusControllerAdminTest.java
index 533c2d3..673e1cd 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusControllerAdminTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusControllerAdminTest.java
@@ -174,7 +174,7 @@
         assertEquals(0, node2.size());
         createAccess(vcCreator, vcName, groupName, admin);
         
-        JsonNode node = listAccessByGroup("admin",groupName);
+        JsonNode node = listRolesByGroup("admin",groupName);
         assertEquals(1, node.size());
         String roleId = node.at("/0/roleId").asText();
         node2 = testAdminListVC_UsingAdminToken(vcCreator,
@@ -183,7 +183,7 @@
         
         Response response = deleteAccess("admin",roleId);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        node = listAccessByGroup("admin",groupName);
+        node = listRolesByGroup("admin",groupName);
         assertEquals(0, node.size());
         
         String json = "{\"type\": \"" + ResourceType.PRIVATE + "\"}";
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusPublishedTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusPublishedTest.java
index c70414a..516b6fc 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusPublishedTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusPublishedTest.java
@@ -57,7 +57,7 @@
                 node.at("/members/0/roles/0").asText());
         String groupName = node.at("/name").asText();
 
-        node = listAccessByGroup("admin", groupName);
+        node = listRolesByGroup("admin", groupName);
         assertEquals(1, node.size());
         assertEquals(vcName, node.at("/0/queryName").asText());
         assertEquals(groupName, node.at("/0/userGroupName").asText());
@@ -80,7 +80,7 @@
     
     private void testHiddenGroupNotFound (String hiddenGroupName)
             throws KustvaktException {
-        JsonNode node = listAccessByGroup("admin", hiddenGroupName);
+        JsonNode node = listRolesByGroup("admin", hiddenGroupName);
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
         assertEquals("Group " + hiddenGroupName + " is not found",
@@ -122,7 +122,7 @@
         
         testDeletePublishedVC("marlin",vcName,"marlin", groupName);
         
-        node = listAccessByGroup("admin", marlinGroupName);
+        node = listRolesByGroup("admin", marlinGroupName);
         assertEquals(0, node.size());
         
         deleteGroupByName(marlinGroupName, "marlin");
@@ -144,7 +144,7 @@
         assertEquals(4, node.size());
         
         // check marlin-group access
-        node = listAccessByGroup("admin", marlinGroupName);
+        node = listRolesByGroup("admin", marlinGroupName);
         assertEquals(1, node.size());
         assertEquals(vcName, node.at("/0/queryName").asText());
         assertEquals(marlinGroupName, node.at("/0/userGroupName").asText());
@@ -153,7 +153,7 @@
         // check hidden group access
         node = getHiddenGroup(vcName);
         String hiddenGroupName = node.at("/name").asText();
-        node = listAccessByGroup("admin", hiddenGroupName);
+        node = listRolesByGroup("admin", hiddenGroupName);
         assertEquals(0, node.at("/0/members").size());
         
         testAddMemberAfterSharingPublishedVC(hiddenGroupName);
@@ -172,10 +172,10 @@
         node = listVC("nemo");
         assertEquals(3, node.size());
 
-        node = listAccessByGroup("admin", marlinGroupName);
+        node = listRolesByGroup("admin", marlinGroupName);
         assertEquals(3, node.at("/0/members").size());
 
-        node = listAccessByGroup("admin", hiddenGroupName);
+        node = listRolesByGroup("admin", hiddenGroupName);
         assertEquals(0, node.at("/0/members").size());
     }
     
@@ -199,7 +199,7 @@
         // check hidden group and roles
         node = getHiddenGroup(vcName);
         String hiddenGroupName = node.at("/name").asText();
-        node = listAccessByGroup("admin", hiddenGroupName);
+        node = listRolesByGroup("admin", hiddenGroupName);
         assertEquals(1, node.size());
         node = node.get(0);
         assertEquals(vcName, node.at("/queryName").asText());
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusSharingTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusSharingTest.java
index 442afdc..f0dffd9 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusSharingTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusSharingTest.java
@@ -66,7 +66,7 @@
         inviteMember(marlinGroupName, "marlin", "nemo");
         subscribe(marlinGroupName, "nemo");
         
-        JsonNode node = listAccessByGroup("marlin", marlinGroupName);
+        JsonNode node = listRolesByGroup("marlin", marlinGroupName);
         assertEquals(0, node.size());
         
         // share by member unauthorized
@@ -81,7 +81,7 @@
 
         response = shareVCByCreator("nemo", "nemo-vc", marlinGroupName);
         
-        node = listAccessByGroup("marlin", marlinGroupName);
+        node = listRolesByGroup("marlin", marlinGroupName);
         assertEquals(1, node.size());
         deleteGroupByName(marlinGroupName, "marlin");
     }
@@ -94,28 +94,32 @@
         String groupName = "DNB-group";
         Response response = createUserGroup(groupName, "DNB users", testUser);
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
-        listUserGroup(testUser, groupName);
+        
+        JsonNode roleNodes = listRolesByGroup(testUser, groupName, false);
+        assertEquals(5, roleNodes.size());
+        
         String memberName = "darla";
         testInviteMember(groupName, testUser, memberName);
-        subscribeToGroup(memberName, groupName);
+        subscribe(groupName, memberName);
         
-        JsonNode node = listAccessByGroup(testUser, groupName);
-        assertEquals(0, node.size());
+        roleNodes = listRolesByGroup(testUser, groupName, false);
+        assertEquals(6, roleNodes.size());
         
         // share vc to group
         shareVCByCreator(testUser, vcName, groupName);
         
         // check member roles
-        node = listAccessByGroup(testUser, groupName);
-        assertEquals(1, node.size());
+        JsonNode queryRoleNodes = listRolesByGroup(testUser, groupName);
+        assertEquals(1, queryRoleNodes.size());
         
-        deleteRoleByGroupAndQuery(testUser, vcName, groupName, testUser);
-        
-        node = listAccessByGroup(testUser, groupName);
-        assertEquals(0, node.size());
+        testDeleteQueryAccessToGroup(testUser, groupName, vcName);
         
         deleteVC(vcName, testUser, testUser);
         deleteGroupByName(groupName, testUser);
+        
+        roleNodes = listRolesByGroup(testUser, groupName, false);
+        assertEquals(StatusCodes.NO_RESOURCE_FOUND,
+                roleNodes.at("/errors/0/0").asInt());
     }
     
     @Test
@@ -141,16 +145,16 @@
         String memberName = "darla";
         response = createUserGroup(groupName, "Owid users", testUser);
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
-        listUserGroup(testUser, groupName);
+
         testInviteMember(groupName, testUser, memberName);
-        subscribeToGroup(memberName, groupName);
+        subscribe(groupName, memberName);
         checkMemberInGroup(memberName, testUser, groupName);
         
         // share vc to group
         shareVCByCreator(testUser, vcName, groupName);
         
         // check member roles
-        node = listAccessByGroup(testUser, groupName);
+        node = listRolesByGroup(testUser, groupName);
         assertEquals(1, node.size());
         
         // search by member
@@ -159,7 +163,7 @@
         node = JsonUtils.readTree(response.readEntity(String.class));
         assertTrue(node.at("/matches").size() > 0);
         // delete project VC
-        deleteVC(vcName, testUser, testUser);
+        testDeleteSharedVC(vcName, testUser, testUser, groupName);
         // list VC
         node = listVC(testUser);
         assertEquals(1, node.size());
@@ -183,10 +187,10 @@
         String groupName = "DNB-group";
         Response response = createUserGroup(groupName, "DNB users", testUser);
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
-        listUserGroup(testUser, groupName);
+        
         String memberName = "darla";
         testInviteMember(groupName, testUser, memberName);
-        subscribeToGroup(memberName, groupName);
+        subscribe(groupName, memberName);
         
         shareVC(testUser, vc1, groupName, testUser);
         shareVC(testUser, vc2, groupName, testUser);
@@ -214,32 +218,50 @@
         
         deleteGroupByName(groupName, testUser);
     }
+    
+    private void testDeleteQueryAccessToGroup (String username,
+            String groupName, String vcName) throws KustvaktException {
+        JsonNode roleNodes = listRolesByGroup(username, groupName, false);
+        assertEquals(7, roleNodes.size());
 
-    private JsonNode listUserGroup (String username, String groupName)
-            throws KustvaktException {
-        Response response = target().path(API_VERSION).path("group").request()
-                .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
-                        .createBasicAuthorizationHeaderValue(username, "pass"))
-                .get();
+        // delete group role
+        deleteRoleByGroupAndQuery(username, vcName, groupName, username);
+
+        JsonNode queryRoleNodes = listRolesByGroup(username, groupName);
+        assertEquals(0, queryRoleNodes.size());
+
+        roleNodes = listRolesByGroup(username, groupName, false);
+        assertEquals(6, roleNodes.size());
+
+    }
+    
+    private void testDeleteSharedVC (String vcName, String vcCreator,
+            String username, String groupName) throws KustvaktException {
+        JsonNode node = listRolesByGroup(username, groupName);
+        assertEquals(1, node.size());
+        
+        Response response = deleteVC(vcName, vcCreator, username);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        String entity = response.readEntity(String.class);
-        JsonNode node = JsonUtils.readTree(entity);
-        return node;
+        
+        node = listRolesByGroup(username, groupName);
+        assertEquals(0, node.size());
     }
 
-    private void subscribeToGroup (String username, String groupName)
-            throws KustvaktException {
-        Response response = target().path(API_VERSION).path("group")
-                .path("@" + groupName).path("subscribe").request()
-                .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
-                        .createBasicAuthorizationHeaderValue(username, "pass"))
-                .post(Entity.form(new Form()));
-        assertEquals(Status.OK.getStatusCode(), response.getStatus());
-    }
+//    private JsonNode listUserGroup (String username, String groupName)
+//            throws KustvaktException {
+//        Response response = target().path(API_VERSION).path("group").request()
+//                .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
+//                        .createBasicAuthorizationHeaderValue(username, "pass"))
+//                .get();
+//        assertEquals(Status.OK.getStatusCode(), response.getStatus());
+//        String entity = response.readEntity(String.class);
+//        JsonNode node = JsonUtils.readTree(entity);
+//        return node;
+//    }
 
     private void checkMemberInGroup (String memberName, String testUser,
             String groupName) throws KustvaktException {
-        JsonNode node = listUserGroup(testUser, groupName).get(0);
+        JsonNode node = listUserGroups(testUser).get(0);
         assertEquals(2, node.get("members").size());
         assertEquals(memberName, node.at("/members/1/userId").asText());
         assertEquals(GroupMemberStatus.ACTIVE.name(),
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusTestBase.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusTestBase.java
index cacca06..0d179bb 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusTestBase.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusTestBase.java
@@ -169,10 +169,18 @@
                 .post(Entity.form(new Form()));
     }
 
-    protected JsonNode listAccessByGroup (String username, String groupName)
+    protected JsonNode listRolesByGroup (String username, String groupName)
+            throws KustvaktException {
+        return listRolesByGroup(username, groupName, true);
+    }
+    
+    protected JsonNode listRolesByGroup (String username, String groupName,
+            boolean hasQuery)
             throws KustvaktException {
         Response response = target().path(API_VERSION).path("vc").path("access")
-                .queryParam("groupName", groupName).request()
+                .queryParam("groupName", groupName)
+                .queryParam("hasQuery", hasQuery)
+                .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .get();