You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by is...@apache.org on 2022/06/16 14:29:48 UTC

[airavata-data-lake] branch master updated: Fix parent resource validation

This is an automated email from the ASF dual-hosted git repository.

isjarana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-data-lake.git


The following commit(s) were added to refs/heads/master by this push:
     new 85bee33  Fix parent resource validation
     new b004161  Merge pull request #116 from isururanawaka/master
85bee33 is described below

commit 85bee3325c89a2346a299801c068b2dc919142bc
Author: Isuru Ranawaka <ir...@gmail.com>
AuthorDate: Thu Jun 16 10:28:54 2022 -0400

    Fix parent resource validation
---
 .../inventories/prod-deployment/group_vars/all/vars.yml    | 14 +++++++-------
 .../airavata/drms/api/handlers/ResourceServiceHandler.java | 12 +++++++++---
 .../drms-api/src/main/resources/application.properties     |  4 ++--
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/ansible/inventories/prod-deployment/group_vars/all/vars.yml b/ansible/inventories/prod-deployment/group_vars/all/vars.yml
index a3b253d..cf4e5bd 100644
--- a/ansible/inventories/prod-deployment/group_vars/all/vars.yml
+++ b/ansible/inventories/prod-deployment/group_vars/all/vars.yml
@@ -35,8 +35,8 @@ kafka_url: "{{ groups['data-lake'][0] }}:9092"
 custos_kafka_url: custos07.sciencegateways.iu.edu:9092
 zookeeper_client_port: 2181
 zookeeper_connection_url: localhost:2181
-custos_host: services.usecustos.org
-custos_port: 31161
+custos_host: prod.custos.usecustos.org
+custos_port: 443
 
 mft_deployment_dir: "{{ user_home }}/mft-deployment"
 mft_source_dir: "{{ user_home }}/mft-source"
@@ -91,8 +91,8 @@ datalake_drms_neo4j_user: "{{ vault_datalake_drms_neo4j_user }}"
 datalake_drms_neo4j_password: "{{ vault_datalake_drms_neo4j_password }}"
 datalake_drms_custos_client_id: "{{ vault_mft_resource_service_custos_client_id }}"
 datalake_drms_custos_client_secret: "{{ vault_mft_resource_service_custos_client_secret }}"
-datalake_drms_custos_host: services.usecustos.org
-datalake_drms_custos_port: 31161
+datalake_drms_custos_host: prod.custos.usecustos.org
+datalake_drms_custos_port: 443
 datalake_drms_http_port: 8900
 
 datalake_synch_broker_url: "{{ custos_kafka_url }}"
@@ -132,11 +132,11 @@ workflow_manager_mft_callback_url: "{{ groups['data-lake'][0] }}:33335"
 workflow_manager_mft_client_id: "{{ vault_workflow_manager_mft_client_id }}"
 workflow_manager_mft_client_secret: "{{ vault_workflow_manager_mft_client_secret }}"
 
-workflow_manager_custos_host: services.usecustos.org
-workflow_manager_custos_port: 31161
+workflow_manager_custos_host: prod.custos.usecustos.org
+workflow_manager_custos_port: 443
 workflow_manager_custos_id: "{{ vault_workflow_manager_custos_id }}"
 workflow_manager_custos_secret: "{{ vault_workflow_manager_custos_secret }}"
-workflow_manager_work_dir: /home/airavata/tmp_data
+workflow_manager_work_dir: /data/tmp_data
 
 emc_portal_source_dir: /home/airavata/emcenter-gateway
 emc_portal_repo: https://github.com/SciGaP/emcenter-gateway.git
diff --git a/data-resource-management-service/drms-api/src/main/java/org/apache/airavata/drms/api/handlers/ResourceServiceHandler.java b/data-resource-management-service/drms-api/src/main/java/org/apache/airavata/drms/api/handlers/ResourceServiceHandler.java
index 220e4d6..a5ad47e 100644
--- a/data-resource-management-service/drms-api/src/main/java/org/apache/airavata/drms/api/handlers/ResourceServiceHandler.java
+++ b/data-resource-management-service/drms-api/src/main/java/org/apache/airavata/drms/api/handlers/ResourceServiceHandler.java
@@ -864,8 +864,14 @@ public class ResourceServiceHandler extends ResourceServiceGrpc.ResourceServiceI
                     Map<String, GenericResource> genericResourceMap = new HashMap<>();
                     AtomicInteger count = new AtomicInteger();
                     genericResourceList.forEach(resource -> {
-                        genericResourceMap.put(String.valueOf(count.get()), resource);
-                        count.getAndIncrement();
+                        try {
+                            if (hasAccessForResource(callUser.getUsername(), callUser.getTenantId(), resource.getResourceId(), "COLLECTION")) {
+                                genericResourceMap.put(String.valueOf(count.get()), resource);
+                                count.getAndIncrement();
+                            }
+                        } catch (Exception exception) {
+                            logger.error(" Error occurred while fetching  parent resources: {}", resource.getResourceId());
+                        }
                     });
 
                     ParentResourcesFetchResponse.Builder builder = ParentResourcesFetchResponse.newBuilder();
@@ -878,7 +884,7 @@ public class ResourceServiceHandler extends ResourceServiceGrpc.ResourceServiceI
                     responseObserver.onCompleted();
                 }
             } else {
-                String msg = " Don't have access to change memberships";
+                String msg = " Don't have access to fetch resource "+ resourseId;
                 responseObserver.onError(Status.PERMISSION_DENIED.withDescription(msg).asRuntimeException());
                 return;
             }
diff --git a/data-resource-management-service/drms-api/src/main/resources/application.properties b/data-resource-management-service/drms-api/src/main/resources/application.properties
index 223b0d2..87baa65 100644
--- a/data-resource-management-service/drms-api/src/main/resources/application.properties
+++ b/data-resource-management-service/drms-api/src/main/resources/application.properties
@@ -23,8 +23,8 @@ group.service.host=localhost
 group.service.port=6565
 custos.id=token
 custos.secret=token
-custos.host=services.usecustos.org
-custos.port=31161
+custos.host=prod.custos.usecustos.org
+custos.port=443
 grpc.port=7070
 local.grpc.port=7070
 server.port=8081