yasithdev commented on code in PR #577:
URL: https://github.com/apache/airavata/pull/577#discussion_r2585715938
##########
airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java:
##########
@@ -1037,40 +822,19 @@ public void updateProject(AuthzToken authzToken, String
projectId, Project updat
public boolean deleteProject(AuthzToken authzToken, String projectId)
throws InvalidRequestException, AiravataClientException,
AiravataSystemException, ProjectNotFoundException,
AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
SharingRegistryService.Client sharingClient =
sharingClientPool.getResource();
try {
- Project existingProject = regClient.getProject(projectId);
- if (ServerSettings.isEnableSharing()
- && !authzToken
- .getClaimsMap()
-
.get(org.apache.airavata.common.utils.Constants.USER_NAME)
- .equals(existingProject.getOwner())
- || !authzToken
- .getClaimsMap()
-
.get(org.apache.airavata.common.utils.Constants.GATEWAY_ID)
- .equals(existingProject.getGatewayId())) {
- try {
- String gatewayId =
authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- String userId =
authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
- gatewayId, userId + "@" + gatewayId, projectId,
gatewayId + ":WRITE")) {
- throw new AuthorizationException("User does not have
permission to access this resource");
- }
- } catch (Exception e) {
- throw new AuthorizationException("User does not have
permission to access this resource");
- }
- }
- boolean ret = regClient.deleteProject(projectId);
- logger.debug("Airavata deleted project with project Id : " +
projectId);
- registryClientPool.returnResource(regClient);
+ boolean ret = airavataService.deleteProjectWithAuth(sharingClient,
authzToken, projectId);
Review Comment:
@lahirujayathilake I made the names consistent across all services and
handlers
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]