From commits-return-17264-apmail-airavata-commits-archive=airavata.apache.org@airavata.apache.org Mon Jun 12 20:45:35 2017 Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE7E31A40A for ; Mon, 12 Jun 2017 20:45:35 +0000 (UTC) Received: (qmail 47369 invoked by uid 500); 12 Jun 2017 20:45:35 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 47301 invoked by uid 500); 12 Jun 2017 20:45:35 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 47288 invoked by uid 99); 12 Jun 2017 20:45:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jun 2017 20:45:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 661EAE024D; Mon, 12 Jun 2017 20:45:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: machristie@apache.org To: commits@airavata.apache.org Date: Mon, 12 Jun 2017 20:45:37 -0000 Message-Id: In-Reply-To: <88f09cde5aac49f18bb02978e02898e3@git.apache.org> References: <88f09cde5aac49f18bb02978e02898e3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Mon Jun 12 16:43:12 2017 -0400 Committer: Marcus Christie 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 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); - } - } }