超级管理员不能删除和修改,防止演示平台的管理员密码被修改造成不能登录。

This commit is contained in:
Junling Bu
2018-03-30 11:50:46 +08:00
parent f095dd0245
commit b1edabf5bf

View File

@@ -89,6 +89,12 @@ public class AdminController {
if(adminId == null){
return ResponseUtil.unlogin();
}
Integer anotherAdminId = admin.getId();
if(anotherAdminId.intValue() == 1){
return ResponseUtil.fail(403, "超级管理员不能修改");
}
adminService.updateById(admin);
return ResponseUtil.ok(admin);
}
@@ -101,7 +107,7 @@ public class AdminController {
Integer anotherAdminId = admin.getId();
if(anotherAdminId.intValue() == 1){
return ResponseUtil.fail(403, "超级用户不能删除");
return ResponseUtil.fail(403, "超级管理员不能删除");
}
adminService.deleteById(anotherAdminId);
return ResponseUtil.ok();