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 2019/06/17 15:18:20 UTC
[airavata] 02/03: AIRAVATA-3440 Add deleteUser to iam admin service
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git
commit 69205a1eaf946a53bb4a021a09d4207d959535cf
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Jun 17 11:16:12 2019 -0400
AIRAVATA-3440 Add deleteUser to iam admin service
---
.../iam/admin/services/cpi/IamAdminServices-remote | 7 +
.../iam/admin/services/cpi/IamAdminServices.py | 233 ++++
.../core/impl/TenantManagementKeycloakImpl.java | 30 +
.../core/interfaces/TenantManagementInterface.java | 10 +
.../profile/handlers/IamAdminServicesHandler.java | 10 +
.../iam/admin/services/cpi/IamAdminServices.java | 1233 +++++++++++++++++++-
.../iam-admin-services-cpi.thrift | 5 +
7 files changed, 1512 insertions(+), 16 deletions(-)
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/airavata/service/profile/iam/admin/services/cpi/IamAdminServices-remote b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/airavata/service/profile/iam/admin/services/cpi/IamAdminServices-remote
index f4a3f2b..876c1a7 100755
--- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/airavata/service/profile/iam/admin/services/cpi/IamAdminServices-remote
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/airavata/service/profile/iam/admin/services/cpi/IamAdminServices-remote
@@ -35,6 +35,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print(' bool resetUserPassword(AuthzToken authzToken, string username, string newPassword)')
print(' findUsers(AuthzToken authzToken, string email, string userId)')
print(' void updateUserProfile(AuthzToken authzToken, UserProfile userDetails)')
+ print(' bool deleteUser(AuthzToken authzToken, string username)')
print(' bool addRoleToUser(AuthzToken authzToken, string username, string roleName)')
print(' bool removeRoleFromUser(AuthzToken authzToken, string username, string roleName)')
print(' getUsersWithRole(AuthzToken authzToken, string roleName)')
@@ -184,6 +185,12 @@ elif cmd == 'updateUserProfile':
sys.exit(1)
pp.pprint(client.updateUserProfile(eval(args[0]), eval(args[1]),))
+elif cmd == 'deleteUser':
+ if len(args) != 2:
+ print('deleteUser requires 2 args')
+ sys.exit(1)
+ pp.pprint(client.deleteUser(eval(args[0]), args[1],))
+
elif cmd == 'addRoleToUser':
if len(args) != 3:
print('addRoleToUser requires 3 args')
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/airavata/service/profile/iam/admin/services/cpi/IamAdminServices.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/airavata/service/profile/iam/admin/services/cpi/IamAdminServices.py
index 1288c82..4b0701c 100644
--- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/airavata/service/profile/iam/admin/services/cpi/IamAdminServices.py
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/airavata/service/profile/iam/admin/services/cpi/IamAdminServices.py
@@ -113,6 +113,14 @@ class Iface(airavata.base.api.BaseAPI.Iface):
"""
pass
+ def deleteUser(self, authzToken, username):
+ """
+ Parameters:
+ - authzToken
+ - username
+ """
+ pass
+
def addRoleToUser(self, authzToken, username, roleName):
"""
Parameters:
@@ -565,6 +573,43 @@ class Client(airavata.base.api.BaseAPI.Client, Iface):
raise result.ae
return
+ def deleteUser(self, authzToken, username):
+ """
+ Parameters:
+ - authzToken
+ - username
+ """
+ self.send_deleteUser(authzToken, username)
+ return self.recv_deleteUser()
+
+ def send_deleteUser(self, authzToken, username):
+ self._oprot.writeMessageBegin('deleteUser', TMessageType.CALL, self._seqid)
+ args = deleteUser_args()
+ args.authzToken = authzToken
+ args.username = username
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_deleteUser(self):
+ iprot = self._iprot
+ (fname, mtype, rseqid) = iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(iprot)
+ iprot.readMessageEnd()
+ raise x
+ result = deleteUser_result()
+ result.read(iprot)
+ iprot.readMessageEnd()
+ if result.success is not None:
+ return result.success
+ if result.Idse is not None:
+ raise result.Idse
+ if result.ae is not None:
+ raise result.ae
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "deleteUser failed: unknown result")
+
def addRoleToUser(self, authzToken, username, roleName):
"""
Parameters:
@@ -695,6 +740,7 @@ class Processor(airavata.base.api.BaseAPI.Processor, Iface, TProcessor):
self._processMap["resetUserPassword"] = Processor.process_resetUserPassword
self._processMap["findUsers"] = Processor.process_findUsers
self._processMap["updateUserProfile"] = Processor.process_updateUserProfile
+ self._processMap["deleteUser"] = Processor.process_deleteUser
self._processMap["addRoleToUser"] = Processor.process_addRoleToUser
self._processMap["removeRoleFromUser"] = Processor.process_removeRoleFromUser
self._processMap["getUsersWithRole"] = Processor.process_getUsersWithRole
@@ -989,6 +1035,31 @@ class Processor(airavata.base.api.BaseAPI.Processor, Iface, TProcessor):
oprot.writeMessageEnd()
oprot.trans.flush()
+ def process_deleteUser(self, seqid, iprot, oprot):
+ args = deleteUser_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = deleteUser_result()
+ try:
+ result.success = self._handler.deleteUser(args.authzToken, args.username)
+ msg_type = TMessageType.REPLY
+ except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
+ raise
+ except airavata.service.profile.iam.admin.services.cpi.error.ttypes.IamAdminServicesException as Idse:
+ msg_type = TMessageType.REPLY
+ result.Idse = Idse
+ except airavata.api.error.ttypes.AuthorizationException as ae:
+ msg_type = TMessageType.REPLY
+ result.ae = ae
+ except Exception as ex:
+ msg_type = TMessageType.EXCEPTION
+ logging.exception(ex)
+ result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
+ oprot.writeMessageBegin("deleteUser", msg_type, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
def process_addRoleToUser(self, seqid, iprot, oprot):
args = addRoleToUser_args()
args.read(iprot)
@@ -2970,6 +3041,168 @@ class updateUserProfile_result(object):
return not (self == other)
+class deleteUser_args(object):
+ """
+ Attributes:
+ - authzToken
+ - username
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'authzToken', (airavata.model.security.ttypes.AuthzToken, airavata.model.security.ttypes.AuthzToken.thrift_spec), None, ), # 1
+ (2, TType.STRING, 'username', 'UTF8', None, ), # 2
+ )
+
+ def __init__(self, authzToken=None, username=None,):
+ self.authzToken = authzToken
+ self.username = username
+
+ def read(self, iprot):
+ if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
+ iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRUCT:
+ self.authzToken = airavata.model.security.ttypes.AuthzToken()
+ self.authzToken.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot._fast_encode is not None and self.thrift_spec is not None:
+ oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('deleteUser_args')
+ if self.authzToken is not None:
+ oprot.writeFieldBegin('authzToken', TType.STRUCT, 1)
+ self.authzToken.write(oprot)
+ oprot.writeFieldEnd()
+ if self.username is not None:
+ oprot.writeFieldBegin('username', TType.STRING, 2)
+ oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.authzToken is None:
+ raise TProtocolException(message='Required field authzToken is unset!')
+ if self.username is None:
+ raise TProtocolException(message='Required field username is unset!')
+ return
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.items()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+
+class deleteUser_result(object):
+ """
+ Attributes:
+ - success
+ - Idse
+ - ae
+ """
+
+ thrift_spec = (
+ (0, TType.BOOL, 'success', None, None, ), # 0
+ (1, TType.STRUCT, 'Idse', (airavata.service.profile.iam.admin.services.cpi.error.ttypes.IamAdminServicesException, airavata.service.profile.iam.admin.services.cpi.error.ttypes.IamAdminServicesException.thrift_spec), None, ), # 1
+ (2, TType.STRUCT, 'ae', (airavata.api.error.ttypes.AuthorizationException, airavata.api.error.ttypes.AuthorizationException.thrift_spec), None, ), # 2
+ )
+
+ def __init__(self, success=None, Idse=None, ae=None,):
+ self.success = success
+ self.Idse = Idse
+ self.ae = ae
+
+ def read(self, iprot):
+ if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
+ iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 0:
+ if ftype == TType.BOOL:
+ self.success = iprot.readBool()
+ else:
+ iprot.skip(ftype)
+ elif fid == 1:
+ if ftype == TType.STRUCT:
+ self.Idse = airavata.service.profile.iam.admin.services.cpi.error.ttypes.IamAdminServicesException()
+ self.Idse.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRUCT:
+ self.ae = airavata.api.error.ttypes.AuthorizationException()
+ self.ae.read(iprot)
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot._fast_encode is not None and self.thrift_spec is not None:
+ oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('deleteUser_result')
+ if self.success is not None:
+ oprot.writeFieldBegin('success', TType.BOOL, 0)
+ oprot.writeBool(self.success)
+ oprot.writeFieldEnd()
+ if self.Idse is not None:
+ oprot.writeFieldBegin('Idse', TType.STRUCT, 1)
+ self.Idse.write(oprot)
+ oprot.writeFieldEnd()
+ if self.ae is not None:
+ oprot.writeFieldBegin('ae', TType.STRUCT, 2)
+ self.ae.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.items()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+
class addRoleToUser_args(object):
"""
Attributes:
diff --git a/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java b/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
index d99a765..b9027e5 100644
--- a/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
+++ b/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
@@ -622,6 +622,36 @@ public class TenantManagementKeycloakImpl implements TenantManagementInterface {
}
@Override
+ public boolean deleteUser(String accessToken, String tenantId, String username) throws IamAdminServicesException {
+ Keycloak client = null;
+ try{
+ client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
+ UserRepresentation userRepresentation = getUserByUsername(client, tenantId, username);
+ if(userRepresentation != null)
+ {
+ client.realm(tenantId).users().delete(userRepresentation.getId());
+ return true;
+ }else{
+ throw new IamAdminServicesException("User [" + username + "] wasn't found in Keycloak!");
+ }
+ } catch (ApplicationSettingsException ex) {
+ logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
+ IamAdminServicesException exception = new IamAdminServicesException();
+ exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
+ throw exception;
+ } catch (Exception ex){
+ logger.error("Error deleting user in keycloak server, reason: " + ex.getMessage(), ex);
+ IamAdminServicesException exception = new IamAdminServicesException();
+ exception.setMessage("Error deleting user in keycloak server, reason: " + ex.getMessage());
+ throw exception;
+ } finally {
+ if (client != null) {
+ client.close();
+ }
+ }
+ }
+
+ @Override
public boolean addRoleToUser(PasswordCredential realmAdminCreds, String tenantId, String username, String roleName) throws IamAdminServicesException {
Keycloak client = null;
diff --git a/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/interfaces/TenantManagementInterface.java b/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/interfaces/TenantManagementInterface.java
index 8f63aeb..fdcb6c0 100644
--- a/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/interfaces/TenantManagementInterface.java
+++ b/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/interfaces/TenantManagementInterface.java
@@ -165,6 +165,16 @@ public interface TenantManagementInterface {
void updateUserProfile(String accessToken, String tenantId, String username, UserProfile userDetails) throws IamAdminServicesException;
/**
+ * Delete this user from the IAM service.
+ * @param accessToken
+ * @param tenantId
+ * @param username
+ * @return
+ * @throws IamAdminServicesException
+ */
+ boolean deleteUser(String accessToken, String tenantId, String username) throws IamAdminServicesException;
+
+ /**
* Add the given role to the user.
*
* @param realmAdminCreds
diff --git a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
index a945f68..ea6d504 100644
--- a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
+++ b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
@@ -224,6 +224,16 @@ public class IamAdminServicesHandler implements IamAdminServices.Iface {
@Override
@SecurityCheck
+ public boolean deleteUser(AuthzToken authzToken, String username) throws IamAdminServicesException, AuthorizationException, TException {
+
+ TenantManagementKeycloakImpl keycloakclient = new TenantManagementKeycloakImpl();
+ String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+
+ return keycloakclient.deleteUser(authzToken.getAccessToken(), gatewayId, username);
+ }
+
+ @Override
+ @SecurityCheck
@Deprecated
public boolean addRoleToUser(AuthzToken authzToken, String username, String roleName) throws IamAdminServicesException, AuthorizationException, TException {
TenantManagementKeycloakImpl keycloakclient = new TenantManagementKeycloakImpl();
diff --git a/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/iam/admin/services/cpi/IamAdminServices.java b/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/iam/admin/services/cpi/IamAdminServices.java
index 1212183..022c687 100644
--- a/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/iam/admin/services/cpi/IamAdminServices.java
+++ b/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/iam/admin/services/cpi/IamAdminServices.java
@@ -1,19 +1,20 @@
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/**
* Autogenerated by Thrift Compiler (0.10.0)
*
@@ -50,6 +51,8 @@ public class IamAdminServices {
public void updateUserProfile(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.airavata.model.user.UserProfile userDetails) throws org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException;
+ public boolean deleteUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username) throws org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException;
+
public boolean addRoleToUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, java.lang.String roleName) throws org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException;
public boolean removeRoleFromUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, java.lang.String roleName) throws org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException;
@@ -82,6 +85,8 @@ public class IamAdminServices {
public void updateUserProfile(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.airavata.model.user.UserProfile userDetails, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException;
+ public void deleteUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException;
+
public void addRoleToUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, java.lang.String roleName, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException;
public void removeRoleFromUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, java.lang.String roleName, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException;
@@ -445,6 +450,36 @@ public class IamAdminServices {
return;
}
+ public boolean deleteUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username) throws org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException
+ {
+ send_deleteUser(authzToken, username);
+ return recv_deleteUser();
+ }
+
+ public void send_deleteUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username) throws org.apache.thrift.TException
+ {
+ deleteUser_args args = new deleteUser_args();
+ args.setAuthzToken(authzToken);
+ args.setUsername(username);
+ sendBase("deleteUser", args);
+ }
+
+ public boolean recv_deleteUser() throws org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException
+ {
+ deleteUser_result result = new deleteUser_result();
+ receiveBase(result, "deleteUser");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.Idse != null) {
+ throw result.Idse;
+ }
+ if (result.ae != null) {
+ throw result.ae;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "deleteUser failed: unknown result");
+ }
+
public boolean addRoleToUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, java.lang.String roleName) throws org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException
{
send_addRoleToUser(authzToken, username, roleName);
@@ -964,6 +999,41 @@ public class IamAdminServices {
}
}
+ public void deleteUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ deleteUser_call method_call = new deleteUser_call(authzToken, username, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class deleteUser_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.Boolean> {
+ private org.apache.airavata.model.security.AuthzToken authzToken;
+ private java.lang.String username;
+ public deleteUser_call(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.authzToken = authzToken;
+ this.username = username;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("deleteUser", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ deleteUser_args args = new deleteUser_args();
+ args.setAuthzToken(authzToken);
+ args.setUsername(username);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public java.lang.Boolean getResult() throws org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new java.lang.IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_deleteUser();
+ }
+ }
+
public void addRoleToUser(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String username, java.lang.String roleName, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException {
checkReady();
addRoleToUser_call method_call = new addRoleToUser_call(authzToken, username, roleName, resultHandler, this, ___protocolFactory, ___transport);
@@ -1099,6 +1169,7 @@ public class IamAdminServices {
processMap.put("resetUserPassword", new resetUserPassword());
processMap.put("findUsers", new findUsers());
processMap.put("updateUserProfile", new updateUserProfile());
+ processMap.put("deleteUser", new deleteUser());
processMap.put("addRoleToUser", new addRoleToUser());
processMap.put("removeRoleFromUser", new removeRoleFromUser());
processMap.put("getUsersWithRole", new getUsersWithRole());
@@ -1397,6 +1468,33 @@ public class IamAdminServices {
}
}
+ public static class deleteUser<I extends Iface> extends org.apache.thrift.ProcessFunction<I, deleteUser_args> {
+ public deleteUser() {
+ super("deleteUser");
+ }
+
+ public deleteUser_args getEmptyArgsInstance() {
+ return new deleteUser_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public deleteUser_result getResult(I iface, deleteUser_args args) throws org.apache.thrift.TException {
+ deleteUser_result result = new deleteUser_result();
+ try {
+ result.success = iface.deleteUser(args.authzToken, args.username);
+ result.setSuccessIsSet(true);
+ } catch (org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse) {
+ result.Idse = Idse;
+ } catch (org.apache.airavata.model.error.AuthorizationException ae) {
+ result.ae = ae;
+ }
+ return result;
+ }
+ }
+
public static class addRoleToUser<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addRoleToUser_args> {
public addRoleToUser() {
super("addRoleToUser");
@@ -1501,6 +1599,7 @@ public class IamAdminServices {
processMap.put("resetUserPassword", new resetUserPassword());
processMap.put("findUsers", new findUsers());
processMap.put("updateUserProfile", new updateUserProfile());
+ processMap.put("deleteUser", new deleteUser());
processMap.put("addRoleToUser", new addRoleToUser());
processMap.put("removeRoleFromUser", new removeRoleFromUser());
processMap.put("getUsersWithRole", new getUsersWithRole());
@@ -2271,6 +2370,76 @@ public class IamAdminServices {
}
}
+ public static class deleteUser<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, deleteUser_args, java.lang.Boolean> {
+ public deleteUser() {
+ super("deleteUser");
+ }
+
+ public deleteUser_args getEmptyArgsInstance() {
+ return new deleteUser_args();
+ }
+
+ public org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean>() {
+ public void onComplete(java.lang.Boolean o) {
+ deleteUser_result result = new deleteUser_result();
+ result.success = o;
+ result.setSuccessIsSet(true);
+ try {
+ fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ } catch (org.apache.thrift.transport.TTransportException e) {
+ _LOGGER.error("TTransportException writing to internal frame buffer", e);
+ fb.close();
+ } catch (java.lang.Exception e) {
+ _LOGGER.error("Exception writing to internal frame buffer", e);
+ onError(e);
+ }
+ }
+ public void onError(java.lang.Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TSerializable msg;
+ deleteUser_result result = new deleteUser_result();
+ if (e instanceof org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException) {
+ result.Idse = (org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException) e;
+ result.setIdseIsSet(true);
+ msg = result;
+ } else if (e instanceof org.apache.airavata.model.error.AuthorizationException) {
+ result.ae = (org.apache.airavata.model.error.AuthorizationException) e;
+ result.setAeIsSet(true);
+ msg = result;
+ } else if (e instanceof org.apache.thrift.transport.TTransportException) {
+ _LOGGER.error("TTransportException inside handler", e);
+ fb.close();
+ return;
+ } else if (e instanceof org.apache.thrift.TApplicationException) {
+ _LOGGER.error("TApplicationException inside handler", e);
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TApplicationException)e;
+ } else {
+ _LOGGER.error("Exception inside handler", e);
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ } catch (java.lang.Exception ex) {
+ _LOGGER.error("Exception writing to internal frame buffer", ex);
+ fb.close();
+ }
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, deleteUser_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException {
+ iface.deleteUser(args.authzToken, args.username,resultHandler);
+ }
+ }
+
public static class addRoleToUser<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addRoleToUser_args, java.lang.Boolean> {
public addRoleToUser() {
super("addRoleToUser");
@@ -14665,6 +14834,1038 @@ public class IamAdminServices {
}
}
+ public static class deleteUser_args implements org.apache.thrift.TBase<deleteUser_args, deleteUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<deleteUser_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("deleteUser_args");
+
+ private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new deleteUser_argsStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new deleteUser_argsTupleSchemeFactory();
+
+ public org.apache.airavata.model.security.AuthzToken authzToken; // required
+ public java.lang.String username; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ AUTHZ_TOKEN((short)1, "authzToken"),
+ USERNAME((short)2, "username");
+
+ private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
+
+ static {
+ for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // AUTHZ_TOKEN
+ return AUTHZ_TOKEN;
+ case 2: // USERNAME
+ return USERNAME;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(java.lang.String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final java.lang.String _fieldName;
+
+ _Fields(short thriftId, java.lang.String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public java.lang.String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.security.AuthzToken.class)));
+ tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(deleteUser_args.class, metaDataMap);
+ }
+
+ public deleteUser_args() {
+ }
+
+ public deleteUser_args(
+ org.apache.airavata.model.security.AuthzToken authzToken,
+ java.lang.String username)
+ {
+ this();
+ this.authzToken = authzToken;
+ this.username = username;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public deleteUser_args(deleteUser_args other) {
+ if (other.isSetAuthzToken()) {
+ this.authzToken = new org.apache.airavata.model.security.AuthzToken(other.authzToken);
+ }
+ if (other.isSetUsername()) {
+ this.username = other.username;
+ }
+ }
+
+ public deleteUser_args deepCopy() {
+ return new deleteUser_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.authzToken = null;
+ this.username = null;
+ }
+
+ public org.apache.airavata.model.security.AuthzToken getAuthzToken() {
+ return this.authzToken;
+ }
+
+ public deleteUser_args setAuthzToken(org.apache.airavata.model.security.AuthzToken authzToken) {
+ this.authzToken = authzToken;
+ return this;
+ }
+
+ public void unsetAuthzToken() {
+ this.authzToken = null;
+ }
+
+ /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthzToken() {
+ return this.authzToken != null;
+ }
+
+ public void setAuthzTokenIsSet(boolean value) {
+ if (!value) {
+ this.authzToken = null;
+ }
+ }
+
+ public java.lang.String getUsername() {
+ return this.username;
+ }
+
+ public deleteUser_args setUsername(java.lang.String username) {
+ this.username = username;
+ return this;
+ }
+
+ public void unsetUsername() {
+ this.username = null;
+ }
+
+ /** Returns true if field username is set (has been assigned a value) and false otherwise */
+ public boolean isSetUsername() {
+ return this.username != null;
+ }
+
+ public void setUsernameIsSet(boolean value) {
+ if (!value) {
+ this.username = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, java.lang.Object value) {
+ switch (field) {
+ case AUTHZ_TOKEN:
+ if (value == null) {
+ unsetAuthzToken();
+ } else {
+ setAuthzToken((org.apache.airavata.model.security.AuthzToken)value);
+ }
+ break;
+
+ case USERNAME:
+ if (value == null) {
+ unsetUsername();
+ } else {
+ setUsername((java.lang.String)value);
+ }
+ break;
+
+ }
+ }
+
+ public java.lang.Object getFieldValue(_Fields field) {
+ switch (field) {
+ case AUTHZ_TOKEN:
+ return getAuthzToken();
+
+ case USERNAME:
+ return getUsername();
+
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ switch (field) {
+ case AUTHZ_TOKEN:
+ return isSetAuthzToken();
+ case USERNAME:
+ return isSetUsername();
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(java.lang.Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof deleteUser_args)
+ return this.equals((deleteUser_args)that);
+ return false;
+ }
+
+ public boolean equals(deleteUser_args that) {
+ if (that == null)
+ return false;
+ if (this == that)
+ return true;
+
+ boolean this_present_authzToken = true && this.isSetAuthzToken();
+ boolean that_present_authzToken = true && that.isSetAuthzToken();
+ if (this_present_authzToken || that_present_authzToken) {
+ if (!(this_present_authzToken && that_present_authzToken))
+ return false;
+ if (!this.authzToken.equals(that.authzToken))
+ return false;
+ }
+
+ boolean this_present_username = true && this.isSetUsername();
+ boolean that_present_username = true && that.isSetUsername();
+ if (this_present_username || that_present_username) {
+ if (!(this_present_username && that_present_username))
+ return false;
+ if (!this.username.equals(that.username))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+
+ hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
+ if (isSetAuthzToken())
+ hashCode = hashCode * 8191 + authzToken.hashCode();
+
+ hashCode = hashCode * 8191 + ((isSetUsername()) ? 131071 : 524287);
+ if (isSetUsername())
+ hashCode = hashCode * 8191 + username.hashCode();
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(deleteUser_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = java.lang.Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthzToken()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = java.lang.Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUsername()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ scheme(iprot).read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ scheme(oprot).write(oprot, this);
+ }
+
+ @Override
+ public java.lang.String toString() {
+ java.lang.StringBuilder sb = new java.lang.StringBuilder("deleteUser_args(");
+ boolean first = true;
+
+ sb.append("authzToken:");
+ if (this.authzToken == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authzToken);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("username:");
+ if (this.username == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.username);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (authzToken == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+ }
+ if (username == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
+ }
+ // check for sub-struct validity
+ if (authzToken != null) {
+ authzToken.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class deleteUser_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public deleteUser_argsStandardScheme getScheme() {
+ return new deleteUser_argsStandardScheme();
+ }
+ }
+
+ private static class deleteUser_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<deleteUser_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, deleteUser_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // AUTHZ_TOKEN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.authzToken = new org.apache.airavata.model.security.AuthzToken();
+ struct.authzToken.read(iprot);
+ struct.setAuthzTokenIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // USERNAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.username = iprot.readString();
+ struct.setUsernameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, deleteUser_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.authzToken != null) {
+ oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+ struct.authzToken.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.username != null) {
+ oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+ oprot.writeString(struct.username);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class deleteUser_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public deleteUser_argsTupleScheme getScheme() {
+ return new deleteUser_argsTupleScheme();
+ }
+ }
+
+ private static class deleteUser_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<deleteUser_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, deleteUser_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ struct.authzToken.write(oprot);
+ oprot.writeString(struct.username);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, deleteUser_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ struct.authzToken = new org.apache.airavata.model.security.AuthzToken();
+ struct.authzToken.read(iprot);
+ struct.setAuthzTokenIsSet(true);
+ struct.username = iprot.readString();
+ struct.setUsernameIsSet(true);
+ }
+ }
+
+ private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+ return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+ }
+ }
+
+ public static class deleteUser_result implements org.apache.thrift.TBase<deleteUser_result, deleteUser_result._Fields>, java.io.Serializable, Cloneable, Comparable<deleteUser_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("deleteUser_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
+ private static final org.apache.thrift.protocol.TField IDSE_FIELD_DESC = new org.apache.thrift.protocol.TField("Idse", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new deleteUser_resultStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new deleteUser_resultTupleSchemeFactory();
+
+ public boolean success; // required
+ public org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse; // required
+ public org.apache.airavata.model.error.AuthorizationException ae; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success"),
+ IDSE((short)1, "Idse"),
+ AE((short)2, "ae");
+
+ private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
+
+ static {
+ for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 0: // SUCCESS
+ return SUCCESS;
+ case 1: // IDSE
+ return IDSE;
+ case 2: // AE
+ return AE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(java.lang.String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final java.lang.String _fieldName;
+
+ _Fields(short thriftId, java.lang.String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public java.lang.String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __SUCCESS_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.IDSE, new org.apache.thrift.meta_data.FieldMetaData("Idse", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException.class)));
+ tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.error.AuthorizationException.class)));
+ metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(deleteUser_result.class, metaDataMap);
+ }
+
+ public deleteUser_result() {
+ }
+
+ public deleteUser_result(
+ boolean success,
+ org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse,
+ org.apache.airavata.model.error.AuthorizationException ae)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ this.Idse = Idse;
+ this.ae = ae;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public deleteUser_result(deleteUser_result other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ if (other.isSetIdse()) {
+ this.Idse = new org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException(other.Idse);
+ }
+ if (other.isSetAe()) {
+ this.ae = new org.apache.airavata.model.error.AuthorizationException(other.ae);
+ }
+ }
+
+ public deleteUser_result deepCopy() {
+ return new deleteUser_result(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ this.Idse = null;
+ this.ae = null;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public deleteUser_result setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ return this;
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ public org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException getIdse() {
+ return this.Idse;
+ }
+
+ public deleteUser_result setIdse(org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse) {
+ this.Idse = Idse;
+ return this;
+ }
+
+ public void unsetIdse() {
+ this.Idse = null;
+ }
+
+ /** Returns true if field Idse is set (has been assigned a value) and false otherwise */
+ public boolean isSetIdse() {
+ return this.Idse != null;
+ }
+
+ public void setIdseIsSet(boolean value) {
+ if (!value) {
+ this.Idse = null;
+ }
+ }
+
+ public org.apache.airavata.model.error.AuthorizationException getAe() {
+ return this.ae;
+ }
+
+ public deleteUser_result setAe(org.apache.airavata.model.error.AuthorizationException ae) {
+ this.ae = ae;
+ return this;
+ }
+
+ public void unsetAe() {
+ this.ae = null;
+ }
+
+ /** Returns true if field ae is set (has been assigned a value) and false otherwise */
+ public boolean isSetAe() {
+ return this.ae != null;
+ }
+
+ public void setAeIsSet(boolean value) {
+ if (!value) {
+ this.ae = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, java.lang.Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((java.lang.Boolean)value);
+ }
+ break;
+
+ case IDSE:
+ if (value == null) {
+ unsetIdse();
+ } else {
+ setIdse((org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException)value);
+ }
+ break;
+
+ case AE:
+ if (value == null) {
+ unsetAe();
+ } else {
+ setAe((org.apache.airavata.model.error.AuthorizationException)value);
+ }
+ break;
+
+ }
+ }
+
+ public java.lang.Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return isSuccess();
+
+ case IDSE:
+ return getIdse();
+
+ case AE:
+ return getAe();
+
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ case IDSE:
+ return isSetIdse();
+ case AE:
+ return isSetAe();
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(java.lang.Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof deleteUser_result)
+ return this.equals((deleteUser_result)that);
+ return false;
+ }
+
+ public boolean equals(deleteUser_result that) {
+ if (that == null)
+ return false;
+ if (this == that)
+ return true;
+
+ boolean this_present_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ return false;
+ }
+
+ boolean this_present_Idse = true && this.isSetIdse();
+ boolean that_present_Idse = true && that.isSetIdse();
+ if (this_present_Idse || that_present_Idse) {
+ if (!(this_present_Idse && that_present_Idse))
+ return false;
+ if (!this.Idse.equals(that.Idse))
+ return false;
+ }
+
+ boolean this_present_ae = true && this.isSetAe();
+ boolean that_present_ae = true && that.isSetAe();
+ if (this_present_ae || that_present_ae) {
+ if (!(this_present_ae && that_present_ae))
+ return false;
+ if (!this.ae.equals(that.ae))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+
+ hashCode = hashCode * 8191 + ((success) ? 131071 : 524287);
+
+ hashCode = hashCode * 8191 + ((isSetIdse()) ? 131071 : 524287);
+ if (isSetIdse())
+ hashCode = hashCode * 8191 + Idse.hashCode();
+
+ hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
+ if (isSetAe())
+ hashCode = hashCode * 8191 + ae.hashCode();
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(deleteUser_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = java.lang.Boolean.valueOf(isSetIdse()).compareTo(other.isSetIdse());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetIdse()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.Idse, other.Idse);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = java.lang.Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAe()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ scheme(iprot).read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ scheme(oprot).write(oprot, this);
+ }
+
+ @Override
+ public java.lang.String toString() {
+ java.lang.StringBuilder sb = new java.lang.StringBuilder("deleteUser_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ sb.append(this.success);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("Idse:");
+ if (this.Idse == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.Idse);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("ae:");
+ if (this.ae == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ae);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class deleteUser_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public deleteUser_resultStandardScheme getScheme() {
+ return new deleteUser_resultStandardScheme();
+ }
+ }
+
+ private static class deleteUser_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<deleteUser_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, deleteUser_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // IDSE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.Idse = new org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException();
+ struct.Idse.read(iprot);
+ struct.setIdseIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // AE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.ae = new org.apache.airavata.model.error.AuthorizationException();
+ struct.ae.read(iprot);
+ struct.setAeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, deleteUser_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.isSetSuccess()) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ oprot.writeFieldEnd();
+ }
+ if (struct.Idse != null) {
+ oprot.writeFieldBegin(IDSE_FIELD_DESC);
+ struct.Idse.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.ae != null) {
+ oprot.writeFieldBegin(AE_FIELD_DESC);
+ struct.ae.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class deleteUser_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public deleteUser_resultTupleScheme getScheme() {
+ return new deleteUser_resultTupleScheme();
+ }
+ }
+
+ private static class deleteUser_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<deleteUser_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, deleteUser_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ java.util.BitSet optionals = new java.util.BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ if (struct.isSetIdse()) {
+ optionals.set(1);
+ }
+ if (struct.isSetAe()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetSuccess()) {
+ oprot.writeBool(struct.success);
+ }
+ if (struct.isSetIdse()) {
+ struct.Idse.write(oprot);
+ }
+ if (struct.isSetAe()) {
+ struct.ae.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, deleteUser_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ java.util.BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.Idse = new org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException();
+ struct.Idse.read(iprot);
+ struct.setIdseIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.ae = new org.apache.airavata.model.error.AuthorizationException();
+ struct.ae.read(iprot);
+ struct.setAeIsSet(true);
+ }
+ }
+ }
+
+ private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+ return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+ }
+ }
+
public static class addRoleToUser_args implements org.apache.thrift.TBase<addRoleToUser_args, addRoleToUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<addRoleToUser_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("addRoleToUser_args");
diff --git a/thrift-interface-descriptions/service-cpis/profile-service/iam-admin-services/iam-admin-services-cpi.thrift b/thrift-interface-descriptions/service-cpis/profile-service/iam-admin-services/iam-admin-services-cpi.thrift
index 0655221..5e7f5d5 100644
--- a/thrift-interface-descriptions/service-cpis/profile-service/iam-admin-services/iam-admin-services-cpi.thrift
+++ b/thrift-interface-descriptions/service-cpis/profile-service/iam-admin-services/iam-admin-services-cpi.thrift
@@ -104,6 +104,11 @@ service IamAdminServices extends base_api.BaseAPI {
throws (1: iam_admin_services_cpi_errors.IamAdminServicesException Idse,
2: airavata_errors.AuthorizationException ae)
+ bool deleteUser(1: required security_model.AuthzToken authzToken,
+ 2: required string username)
+ throws (1: iam_admin_services_cpi_errors.IamAdminServicesException Idse,
+ 2: airavata_errors.AuthorizationException ae)
+
bool addRoleToUser(1: required security_model.AuthzToken authzToken,
2: required string username,
3: required string roleName)