Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix user admin delete bug #2685

Merged
merged 4 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.dinky.data.enums.Status;
import org.dinky.data.enums.UserType;
import org.dinky.data.exception.AuthException;
import org.dinky.data.exception.BusException;
import org.dinky.data.model.SysToken;
import org.dinky.data.model.SystemConfiguration;
import org.dinky.data.model.rbac.Menu;
Expand Down Expand Up @@ -152,6 +153,10 @@ public Result<Void> modifyPassword(ModifyPasswordDTO modifyPasswordDTO) {

@Override
public Boolean removeUser(Integer id) {
User user = getById(id);
if (user.getSuperAdminFlag()) {
throw new BusException(Status.USER_SUPERADMIN_CANNOT_DELETE);
}
return baseMapper.deleteById(id) > 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public enum Status {
KICK_OUT(10024, "kick.out"),
TOKEN_FREEZED(10025, "token.freezed"),
NO_PREFIX(10026, "no.prefix"),
USER_SUPERADMIN_CANNOT_DELETE(10027, "user.superadmin.cannot.delete"),

// role
ROLE_ALREADY_EXISTS(10101, "role.already.exists"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ldap.user.duplicat=The ldap matches to multiple user data
git.branch.not.found=Git Branch Not Found
copy.success=Copy Successfully
user.superadmin.cannot.disable=User SuperAdmin Cannot Disable
user.superadmin.cannot.delete=User SuperAdmin Cannot Delete
ds.work.flow.not.save=Please Save Workflow First
schedule.status.unknown=Unknown Status: {0}
user.binding.role.delete.all=User Binding Role Delete All
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ldap.user.duplicat=ldap匹配到多个用户数据
git.branch.not.found=获取不到分支信息
copy.success=复制成功
user.superadmin.cannot.disable=超级管理员用户不能停用
user.superadmin.cannot.delete=超级管理员用户不能删除
ds.work.flow.not.save=请先保存工作流
schedule.status.unknown=未知状态: {0}
user.binding.role.delete.all=用户绑定角色删除所有
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ const UserProTable = () => {
</Authorized>,
<Authorized key={`${record.id}_delete_auth`} path='/auth/user/delete'>
<>
{access.isAdmin && !record.isDelete && (
{access.isAdmin && !record.isDelete && !record.superAdminFlag && (
<PopconfirmDeleteBtn
key={`${record.id}_delete`}
onClick={() => handleDeleteUser(record)}
Expand Down
Loading