[ 
https://issues.apache.org/jira/browse/AIRAVATA-2601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16279275#comment-16279275
 ] 

ASF GitHub Bot commented on AIRAVATA-2601:
------------------------------------------

tilaks26 commented on a change in pull request #146: [AIRAVATA-2601] Adding 
groups to Applications
URL: https://github.com/apache/airavata/pull/146#discussion_r155092076
 
 

 ##########
 File path: 
airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
 ##########
 @@ -1747,16 +1761,24 @@ public ExperimentStatus getExperimentStatus(AuthzToken 
authzToken, String airava
     @Override
     @SecurityCheck
     public void launchExperiment(AuthzToken authzToken, final String 
airavataExperimentId, String gatewayId)
-            throws TException {
+            throws AuthorizationException, AiravataSystemException, TException 
{
         RegistryService.Client regClient = registryClientPool.getResource();
+        SharingRegistryService.Client sharingClient = 
sharingClientPool.getResource();
         try {
             ExperimentModel experiment = 
regClient.getExperiment(airavataExperimentId);
+            String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
+            String entityId = experiment.getExecutionId();
+            if (!sharingClient.userHasAccess(gatewayId, userId + "@" + 
gatewayId, entityId,gatewayId + ":READ")) {
+                logger.error(airavataExperimentId, "User does not have access 
to application module {}.", entityId);
+                throw new AuthorizationException("User does not have 
permission to access this resource");
+            }
             if (experiment == null) {
                 logger.error(airavataExperimentId, "Error while launching 
experiment, experiment {} doesn't exist.", airavataExperimentId);
                 throw new ExperimentNotFoundException("Requested experiment id 
" + airavataExperimentId + " does not exist in the system..");
             }
             submitExperiment(gatewayId, airavataExperimentId);
             registryClientPool.returnResource(regClient);
+            sharingClientPool.returnResource(sharingClient);
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Adding Groups to Applications
> -----------------------------
>
>                 Key: AIRAVATA-2601
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2601
>             Project: Airavata
>          Issue Type: Improvement
>          Components: Registry API
>            Reporter: Sneha Tilak
>            Assignee: Sneha Tilak
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to