Skip to content
Permalink
Browse files
check if user is empty when delete palo user (#24)
check if user is empty when delete palo user
  • Loading branch information
liruixl committed Mar 29, 2022
1 parent 00e96af commit b2c3c772033e91f828dd6acabff615f5958a3b61
Showing 2 changed files with 19 additions and 11 deletions.
@@ -447,20 +447,24 @@ public void deleteSpace(long spaceId) throws Exception {
// delete cluster information
clusterInfoRepository.deleteById(spaceId);

// delete cluster configuration
log.debug("delete cluster {} config infos.", spaceId);
settingComponent.deleteAdminSetting(spaceId);
try {
// delete cluster configuration
log.debug("delete cluster {} config infos.", spaceId);
settingComponent.deleteAdminSetting(spaceId);

deleteClusterPermissionInfo(clusterInfo);
deleteClusterPermissionInfo(clusterInfo);

// delete user information
log.debug("delete cluster {} all user membership.", spaceId);
clusterUserMembershipRepository.deleteByClusterId(spaceId);
// delete user information
log.debug("delete cluster {} all user membership.", spaceId);
clusterUserMembershipRepository.deleteByClusterId(spaceId);

// TODO: In order to be compatible with the deleted content of spatial information before, it is put here.
// If the interface that releases both cluster and physical resources is implemented later,
// it will be unified in the current doriscluster processing operation
clusterManager.deleteClusterOperation(clusterInfo);
// TODO: In order to be compatible with the deleted content of spatial information before, it is put here.
// If the interface that releases both cluster and physical resources is implemented later,
// it will be unified in the current doriscluster processing operation
clusterManager.deleteClusterOperation(clusterInfo);
} catch (Exception e) {
log.warn("delete space {} related information failed", spaceId, e);
}
}

private void deleteClusterPermissionInfo(ClusterInfoEntity clusterInfo) throws Exception {
@@ -77,6 +77,10 @@ public String createUser(String ns, String db, ClusterInfoEntity entity, String
}

public void deleteUser(String ns, String db, ClusterInfoEntity entity, String userName) {
if (userName == null) {
log.warn("user name is null");
return;
}
if (userName.startsWith("Analyzer") || userName.startsWith("Administrators")) {
try {
String deleteSql = "DROP USER '" + userName + "'@'%'";

0 comments on commit b2c3c77

Please sign in to comment.