无法删除当前登录用户

This commit is contained in:
shiziyuan9527 2020-05-12 15:34:48 +08:00
parent 80a50999a7
commit 5a703e080e
3 changed files with 8 additions and 2 deletions

View File

@ -131,6 +131,10 @@ public class UserService {
} }
public void deleteUser(String userId) { public void deleteUser(String userId) {
SessionUser user = SessionUtils.getUser();
if (StringUtils.equals(user.getId(), userId)) {
MSException.throwException(Translator.get("cannot_delete_current_user"));
}
userMapper.deleteByPrimaryKey(userId); userMapper.deleteByPrimaryKey(userId);
} }

View File

@ -33,3 +33,4 @@ workspace_not_exists=Workspace is not exists
api_load_script_error=Load script error api_load_script_error=Load script error
user_id_already_exists=User ID already exists user_id_already_exists=User ID already exists
password_modification_failed=Password modification failed password_modification_failed=Password modification failed
cannot_delete_current_user=Cannot delete the user currently logged in

View File

@ -33,3 +33,4 @@ workspace_not_exists=工作空间不存在
api_load_script_error=读取脚本失败 api_load_script_error=读取脚本失败
user_id_already_exists=用户id已存在 user_id_already_exists=用户id已存在
password_modification_failed=密码修改失败 password_modification_failed=密码修改失败
cannot_delete_current_user=无法删除当前登录用户