You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/06/12 20:45:37 UTC
[5/5] airavata git commit: AIRAVATA-2408 Remove user profile service
methods from API
AIRAVATA-2408 Remove user profile service methods from API
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e0613616
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e0613616
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e0613616
Branch: refs/heads/develop
Commit: e061361650cecee38046560e5566860e9fab0f9b
Parents: 4e7d7cc
Author: Marcus Christie <ma...@apache.org>
Authored: Mon Jun 12 16:43:12 2017 -0400
Committer: Marcus Christie <ma...@apache.org>
Committed: Mon Jun 12 16:43:12 2017 -0400
----------------------------------------------------------------------
.../server/handler/AiravataServerHandler.java | 123 -
.../java/org/apache/airavata/api/Airavata.java | 55575 +++++++----------
.../resources/lib/Airavata/API/Airavata.php | 11335 ++--
.../lib/Airavata/Model/Workspace/Types.php | 133 +-
.../Iam/Admin/Services/CPI/IamAdminServices.php | 272 +
.../Profile/Tenant/CPI/TenantProfileService.php | 357 +-
.../airavata/model/workspace/Gateway.java | 688 +-
.../airavata-apis/airavata_api.thrift | 38 -
8 files changed, 28805 insertions(+), 39716 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/e0613616/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 14fc841..86e47b0 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
@@ -4772,119 +4772,6 @@ public class AiravataServerHandler implements Airavata.Iface {
}
}
- @Override
- @SecurityCheck
- public String addUserProfile(AuthzToken authzToken, UserProfile userProfile)
- throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
-
- // check that username and gatewayId match authzToken
- String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if( !userProfile.getUserId().equals(userId) || !userProfile.getGatewayId().equals(gatewayId) ){
- throw new AuthorizationException("User isn't authorized to add user profile for this user and/or gateway");
- }
- try {
- return getUserProfileServiceClient().addUserProfile(authzToken, userProfile);
- } catch (Exception e) {
- String msg = "Error adding user profile";
- logger.error(msg, e);
- AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(msg + " More info : " + e.getMessage());
- throw exception;
- }
- }
-
- @Override
- @SecurityCheck
- public boolean updateUserProfile(AuthzToken authzToken, UserProfile userProfile)
- throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
-
- // check that username and gatewayId match authzToken
- String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if( !userProfile.getUserId().equals(userId) || !userProfile.getGatewayId().equals(gatewayId) ){
- throw new AuthorizationException("User isn't authorized to update user profile for this user and/or gateway");
- }
- try {
- return getUserProfileServiceClient().updateUserProfile(authzToken, userProfile);
- } catch (Exception e) {
- String msg = "Error updating user profile";
- logger.error(msg, e);
- AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(msg + " More info : " + e.getMessage());
- throw exception;
- }
- }
-
- @Override
- @SecurityCheck
- public UserProfile getUserProfileById(AuthzToken authzToken, String userId, String gatewayId)
- throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
-
- try {
- return getUserProfileServiceClient().getUserProfileById(authzToken, userId, gatewayId);
- } catch (Exception e) {
- String msg = MessageFormat.format("Error getting user profile for [{0}] in [{1}]", userId, gatewayId);
- logger.error(msg, e);
- AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(msg + " More info : " + e.getMessage());
- throw exception;
- }
- }
-
- @Override
- @SecurityCheck
- // FIXME: deleting user profile should require the gatewayId as well!
- public boolean deleteUserProfile(AuthzToken authzToken, String userId)
- throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
-
- // check that userId match authzToken
- if( !authzToken.getClaimsMap().get(Constants.USER_NAME).equals(userId) ){
- throw new AuthorizationException("User isn't authorized to delete user profile for this user");
- }
- try {
- return getUserProfileServiceClient().deleteUserProfile(authzToken, userId, null);
- } catch (Exception e) {
- String msg = "Error deleting user profile";
- logger.error(msg, e);
- AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(msg + " More info : " + e.getMessage());
- throw exception;
- }
- }
-
- @Override
- @SecurityCheck
- public List<UserProfile> getAllUserProfilesInGateway(AuthzToken authzToken, String gatewayId, int offset, int limit)
- throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
-
- try {
- return getUserProfileServiceClient().getAllUserProfilesInGateway(authzToken, gatewayId, offset, limit);
- } catch (Exception e) {
- String msg = MessageFormat.format("Error getting all user profiles for [{0}] with offset={1} and limit={2}", gatewayId, offset, limit);
- logger.error(msg, e);
- AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(msg + " More info : " + e.getMessage());
- throw exception;
- }
- }
-
- @Override
- @SecurityCheck
- public boolean doesUserProfileExist(AuthzToken authzToken, String userName, String gatewayId)
- throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
-
- try {
- return getUserProfileServiceClient().doesUserExist(authzToken, userName, gatewayId);
- } catch (Exception e) {
- String msg = MessageFormat.format("Error checking if user profile exists for [{0}] in [{1}]", userName, gatewayId);
- logger.error(msg, e);
- AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(msg + " More info : " + e.getMessage());
- throw exception;
- }
- }
-
private void submitExperiment(String gatewayId,String experimentId) throws AiravataException {
ExperimentSubmitEvent event = new ExperimentSubmitEvent(experimentId, gatewayId);
MessageContext messageContext = new MessageContext(event, MessageType.EXPERIMENT, "LAUNCH.EXP-" + UUID.randomUUID().toString(), gatewayId);
@@ -4928,14 +4815,4 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new TException("Unable to create sharing registry client...", e);
}
}
-
- private UserProfileService.Client getUserProfileServiceClient() throws TException, ApplicationSettingsException {
- final int serverPort = Integer.parseInt(ServerSettings.getProfileServiceServerPort());
- final String serverHost = ServerSettings.getProfileServiceServerHost();
- try {
- return ProfileServiceClientFactory.createUserProfileServiceClient(serverHost, serverPort);
- } catch (UserProfileServiceException e) {
- throw new TException("Unable to create user profile service client...", e);
- }
- }
}