airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata] branch group-based-auth updated: AIRAVATA-2816 Return empty project list when user has no projects
Date Wed, 06 Jun 2018 18:02:38 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch group-based-auth
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/group-based-auth by this push:
     new 2919c7a  AIRAVATA-2816 Return empty project list when user has no projects
2919c7a is described below

commit 2919c7af8328a159eeb5aef0d7dddb0211088d27
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Wed Jun 6 14:01:48 2018 -0400

    AIRAVATA-2816 Return empty project list when user has no projects
---
 .../api/server/handler/AiravataServerHandler.java        | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 7d0c5d8..6482ca1 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -1043,7 +1043,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                 sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                         userName + "@" + gatewayId, filters, 0, -1).stream().forEach(p ->
accessibleProjectIds
                         .add(p.entityId));
-                List<Project> result = regClient.searchProjects(gatewayId, userName,
accessibleProjectIds, new HashMap<>(), limit, offset);
+                List<Project> result;
+                if (accessibleProjectIds.isEmpty()) {
+                    result = Collections.emptyList();
+                } else {
+                    result = regClient.searchProjects(gatewayId, userName, accessibleProjectIds,
new HashMap<>(), limit, offset);
+                }
                 registryClientPool.returnResource(regClient);
                 sharingClientPool.returnResource(sharingClient);
                 return result;
@@ -1095,6 +1100,7 @@ public class AiravataServerHandler implements Airavata.Iface {
         try {
             List<String> accessibleProjIds  = new ArrayList<>();
 
+            List<Project> result;
             if (ServerSettings.isEnableSharing()) {
                 List<SearchCriteria> sharingFilters = new ArrayList<>();
                 SearchCriteria searchCriteria = new SearchCriteria();
@@ -1104,8 +1110,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                 sharingFilters.add(searchCriteria);
                 sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                         userName + "@" + gatewayId, sharingFilters, 0, -1).stream().forEach(e
-> accessibleProjIds.add(e.entityId));
+                if (accessibleProjIds.isEmpty()) {
+                    result = Collections.emptyList();
+                } else {
+                    result = regClient.searchProjects(gatewayId, userName, accessibleProjIds,
filters, limit, offset);
+                }
+            } else {
+                result = regClient.searchProjects(gatewayId, userName, accessibleProjIds,
filters, limit, offset);
             }
-            List<Project> result = regClient.searchProjects(gatewayId, userName, accessibleProjIds,
filters, limit, offset);
             registryClientPool.returnResource(regClient);
             sharingClientPool.returnResource(sharingClient);
             return result;

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.

Mime
View raw message