From 375cdf4dc3d03828a314facdc23aa1ad71abd5b2 Mon Sep 17 00:00:00 2001 From: zhengjie <201507802@qq.com> Date: Thu, 20 Jun 2019 17:38:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E5=9B=BE=E5=BD=A2=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E5=B7=A5=E5=85=B7=EF=BC=8C=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zhengjie/modules/system/rest/MenuController.java | 6 ------ .../modules/system/rest/PermissionController.java | 6 ------ .../zhengjie/modules/system/rest/RoleController.java | 12 ------------ .../zhengjie/modules/system/rest/UserController.java | 9 --------- 4 files changed, 33 deletions(-) diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java index aa61f7ac..dca2c700 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java @@ -81,9 +81,6 @@ public class MenuController { @PutMapping(value = "/menus") @PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_EDIT')") public ResponseEntity update(@Validated(Menu.Update.class) @RequestBody Menu resources){ - if (resources.getId() <= new Long(39).longValue()) { - throw new BadRequestException("演示环境不可操作"); - } menuService.update(resources); return new ResponseEntity(HttpStatus.NO_CONTENT); } @@ -92,9 +89,6 @@ public class MenuController { @DeleteMapping(value = "/menus/{id}") @PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_DELETE')") public ResponseEntity delete(@PathVariable Long id){ - if (id.longValue() <= new Long(39).longValue()) { - throw new BadRequestException("演示环境不可操作"); - } List menuList = menuService.findByPid(id); // 特殊情况,对级联删除进行处理 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/PermissionController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/PermissionController.java index 6ea323d5..3cb805a3 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/PermissionController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/PermissionController.java @@ -60,9 +60,6 @@ public class PermissionController { @PutMapping(value = "/permissions") @PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_EDIT')") public ResponseEntity update(@Validated(Permission.Update.class) @RequestBody Permission resources){ - if (resources.getId() <= new Long(54).longValue()) { - throw new BadRequestException("演示环境不可操作"); - } permissionService.update(resources); return new ResponseEntity(HttpStatus.NO_CONTENT); } @@ -71,9 +68,6 @@ public class PermissionController { @DeleteMapping(value = "/permissions/{id}") @PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_DELETE')") public ResponseEntity delete(@PathVariable Long id){ - if (id <= new Long(54).longValue()) { - throw new BadRequestException("演示环境不可操作"); - } permissionService.delete(id); return new ResponseEntity(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java index 4c070307..8c1d2793 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java @@ -82,9 +82,6 @@ public class RoleController { @PutMapping(value = "/roles") @PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')") public ResponseEntity update(@Validated(Role.Update.class) @RequestBody Role resources){ - if (resources.getId().equals(1L)) { - throw new BadRequestException("演示环境不可操作"); - } roleService.update(resources); return new ResponseEntity(HttpStatus.NO_CONTENT); } @@ -93,9 +90,6 @@ public class RoleController { @PutMapping(value = "/roles/permission") @PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')") public ResponseEntity updatePermission(@RequestBody Role resources){ - if (resources.getId().equals(1L)) { - throw new BadRequestException("演示环境不可操作"); - } roleService.updatePermission(resources,roleService.findById(resources.getId())); return new ResponseEntity(HttpStatus.NO_CONTENT); } @@ -104,9 +98,6 @@ public class RoleController { @PutMapping(value = "/roles/menu") @PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')") public ResponseEntity updateMenu(@RequestBody Role resources){ - if (resources.getId().equals(1L)) { - throw new BadRequestException("演示环境不可操作"); - } roleService.updateMenu(resources,roleService.findById(resources.getId())); return new ResponseEntity(HttpStatus.NO_CONTENT); } @@ -115,9 +106,6 @@ public class RoleController { @DeleteMapping(value = "/roles/{id}") @PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_DELETE')") public ResponseEntity delete(@PathVariable Long id){ - if (id.equals(1L)) { - throw new BadRequestException("演示环境不可操作"); - } roleService.delete(id); return new ResponseEntity(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java index 789ecd9d..6bc4337b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java @@ -102,9 +102,6 @@ public class UserController { @PutMapping(value = "/users") @PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_EDIT')") public ResponseEntity update(@Validated(User.Update.class) @RequestBody User resources){ - if (resources.getId().equals(1L)) { - throw new BadRequestException("演示环境不可操作"); - } checkLevel(resources); userService.update(resources); return new ResponseEntity(HttpStatus.NO_CONTENT); @@ -114,9 +111,6 @@ public class UserController { @DeleteMapping(value = "/users/{id}") @PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_DELETE')") public ResponseEntity delete(@PathVariable Long id){ - if (id.equals(1L)) { - throw new BadRequestException("演示环境不可操作"); - } Integer currentLevel = Collections.min(roleService.findByUsers_Id(SecurityUtils.getUserId()).stream().map(RoleSmallDTO::getLevel).collect(Collectors.toList())); Integer optLevel = Collections.min(roleService.findByUsers_Id(id).stream().map(RoleSmallDTO::getLevel).collect(Collectors.toList())); @@ -151,9 +145,6 @@ public class UserController { @PostMapping(value = "/users/updatePass") public ResponseEntity updatePass(@RequestBody User user){ UserDetails userDetails = SecurityUtils.getUserDetails(); - if (userDetails.getUsername().equals("admin")) { - throw new BadRequestException("演示环境不可操作"); - } if(userDetails.getPassword().equals(EncryptUtils.encryptPassword(user.getPassword()))){ throw new BadRequestException("新密码不能与旧密码相同"); }