Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRAVATA-2601] Adding groups to Applications #146

Closed
wants to merge 0 commits into from

Conversation

tilaks26
Copy link
Contributor

@tilaks26 tilaks26 commented Dec 1, 2017

Filtering of Application Deployments by gateway ID and user name. We first get a list of Application Deployment IDs that are accessible by the current user and then retrieve the list of Application Deployments. (Similar to how we search for Experiments).

Files changed:

  • AiravataDataMigrator.java -> Included a new Entity Type names APPLICATION
  • AiravataServerHandler.java -> Modified getAllApplicationDeployments(), getAllAppModules() methods to filter the accessible Application IDs using the user name
  • registry-api.thrift -> Modified getAllApplicationDeployments(), getAllAppModules() methods' parameter list to include the accessible Application IDs
  • RegistryService.java -> Regenerated the Thrift stubs which changed the Registry Service interface
  • ApplicationDeployment.java -> Modified getAllApplicationDeployements() method to include accessible Application Deployment IDs
  • ApplicationInterface.java -> Modified getAllAppModules() method to include accessible Application Module IDs
  • RegistryServerHandler.java -> Modified getAllApplicationDeployments(), getAllAppModules() methods to reflect the changes in ApplicationDeployment.java and RegistryService.java files

TODO:

  • Modify the launchExperiment() method in AiravataServerHandler.java to first check if the user has access to launch an Experiment in the Application Module.

@tilaks26
Copy link
Contributor Author

tilaks26 commented Dec 4, 2017

Files changed:

  • AiravataServerHandler.java -> Modified launchExperiment() to first check if the current user has access to the Application Module

Copy link
Contributor

@machristie machristie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this pull request Sneha. See my comments.

try {
ExperimentModel experiment = regClient.getExperiment(airavataExperimentId);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
String entityId = experiment.getExecutionId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The execution id is the application interface id. You need to fetch the application interface and get the application module id from it, and then check to see if the user has access to the application module id.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably return the sharingClient to the pool as a broken resource, like what is done for the regClient, see line 1787.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

registryClientPool.returnResource(regClient);
sharingClientPool.returnResource(sharingClient);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about returning the sharingClient in the catch clause.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -86,7 +86,7 @@
*/
List<ApplicationModule> getApplicationModules(Map<String, String> filters) throws AppCatalogException;

List<ApplicationModule> getAllApplicationModules(String gatewayId) throws AppCatalogException;
List<ApplicationModule> getAllApplicationModules(String gatewayId, List<String> accessibleAppIds) throws AppCatalogException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's the implementation for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -53,7 +53,7 @@
*/
List<ApplicationDeploymentDescription> getApplicationDeployements (Map<String, String> filters) throws AppCatalogException;

List<ApplicationDeploymentDescription> getAllApplicationDeployements (String gatewayId) throws AppCatalogException;
List<ApplicationDeploymentDescription> getAllApplicationDeployements (String gatewayId, List<String> accessibleIds) throws AppCatalogException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's the implementation of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

entity.setDomainId(rs.getString("GATEWAY_ID"));
entity.setEntityTypeId(rs.getString("GATEWAY_ID") + ":APPLICATION");
entity.setOwnerId(rs.getString("USER_NAME") + "@" + rs.getString("GATEWAY_ID"));
entity.setParentEntityId(rs.getString("PROJECT_ID"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just leave parent entity id null since there really isn't a parent of an application.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -774,7 +774,8 @@ service RegistryService {
* Returns the list of all Application Module Objects.
*
*/
list<application_deployment_model.ApplicationModule> getAllAppModules (1: required string gatewayId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the method documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -869,11 +870,15 @@ service RegistryService {
* @param gatewayId
* ID of the gateway which need to list all available application deployment documentation.
*
* @param userName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise please update the method documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants