You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/11/10 20:08:43 UTC

[3/7] airavata git commit: AIRAVATA-2207 Add getExperimentByAdmin method

AIRAVATA-2207 Add getExperimentByAdmin method


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/0fda5a8f
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/0fda5a8f
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/0fda5a8f

Branch: refs/heads/develop
Commit: 0fda5a8fc0e113a8eb13685ba1d419c2c1a16934
Parents: 2e7fb05
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Nov 10 12:36:38 2016 -0500
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Nov 10 12:36:38 2016 -0500

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |    23 +
 .../java/org/apache/airavata/api/Airavata.java  | 15034 +++++++++--------
 .../resources/lib/Airavata/API/Airavata.php     |   436 +
 .../resources/airavata-default-xacml-policy.xml |     1 +
 .../airavata-apis/airavata_api.thrift           |    43 +
 5 files changed, 8815 insertions(+), 6722 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/0fda5a8f/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
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 0f56747..2f7a014 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
@@ -1200,6 +1200,29 @@ public class AiravataServerHandler implements Airavata.Iface {
         }
     }
 
+    @Override
+    @SecurityCheck
+    public ExperimentModel getExperimentByAdmin(AuthzToken authzToken, String airavataExperimentId)
+            throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+
+        ExperimentModel experimentModel = null;
+        try {
+            String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+            experimentModel = getRegistryServiceClient().getExperiment(airavataExperimentId);
+            if(gatewayId.equals(experimentModel.getGatewayId())){
+                return experimentModel;
+            } else {
+                throw new AuthorizationException("User does not have permission to access this resource");
+            }
+        } catch (ApplicationSettingsException e) {
+            logger.error("Error while getting the experiment", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while getting the experiment. More info : " + e.getMessage());
+            throw exception;
+        }
+    }
+
     /**
      * Fetch the completed nested tree structue of previously created experiment metadata which includes processes ->
      * tasks -> jobs information.