Loading transfer_service/db_connector.py +25 −6 Original line number Diff line number Diff line Loading @@ -1336,6 +1336,25 @@ class DbConnector(object): try: conn = self.getConnection() cursor = conn.cursor(cursor_factory = RealDictCursor) username = self.getUserName(userId) userNodePath = "/" + username cursor.execute(""" SELECT count(*) > 1 AS child_nodes FROM node WHERE creator_id = %s AND path <@ text2ltree(id_from_vos_path(%s)::text); """, (userId, userNodePath,)) result = cursor.fetchall()[0]["child_nodes"] except Exception: if not conn.closed: conn.rollback() raise else: if result: return False else: try: cursor.execute(""" DELETE FROM users WHERE user_id = %s; Loading transfer_service/user_rpc_server.py +9 −2 Original line number Diff line number Diff line Loading @@ -108,7 +108,14 @@ class UserRPCServer(RedisRPCServer): "errorMsg": errorMsg } return response else: if result: response = { "responseType": "USER_DEL_DONE" } else: errorMsg = "The user cannot be removed because its VOSpace node has child nodes." self.logger.error(errorMsg) response = { "responseType": "ERROR", "errorCode": 4, "errorMsg": errorMsg } elif requestBody["requestType"] == "USER_SEARCH": searchStr = requestBody["searchStr"] try: Loading @@ -127,7 +134,7 @@ class UserRPCServer(RedisRPCServer): errorMsg = "Unkown request type." self.logger.error(errorMsg) response = { "responseType": "ERROR", "errorCode": 4, "errorCode": 5, "errorMsg": errorMsg } return response Loading Loading
transfer_service/db_connector.py +25 −6 Original line number Diff line number Diff line Loading @@ -1336,6 +1336,25 @@ class DbConnector(object): try: conn = self.getConnection() cursor = conn.cursor(cursor_factory = RealDictCursor) username = self.getUserName(userId) userNodePath = "/" + username cursor.execute(""" SELECT count(*) > 1 AS child_nodes FROM node WHERE creator_id = %s AND path <@ text2ltree(id_from_vos_path(%s)::text); """, (userId, userNodePath,)) result = cursor.fetchall()[0]["child_nodes"] except Exception: if not conn.closed: conn.rollback() raise else: if result: return False else: try: cursor.execute(""" DELETE FROM users WHERE user_id = %s; Loading
transfer_service/user_rpc_server.py +9 −2 Original line number Diff line number Diff line Loading @@ -108,7 +108,14 @@ class UserRPCServer(RedisRPCServer): "errorMsg": errorMsg } return response else: if result: response = { "responseType": "USER_DEL_DONE" } else: errorMsg = "The user cannot be removed because its VOSpace node has child nodes." self.logger.error(errorMsg) response = { "responseType": "ERROR", "errorCode": 4, "errorMsg": errorMsg } elif requestBody["requestType"] == "USER_SEARCH": searchStr = requestBody["searchStr"] try: Loading @@ -127,7 +134,7 @@ class UserRPCServer(RedisRPCServer): errorMsg = "Unkown request type." self.logger.error(errorMsg) response = { "responseType": "ERROR", "errorCode": 4, "errorCode": 5, "errorMsg": errorMsg } return response Loading