Browse Source

增加@PreAuth注解

test
smallchill 6 years ago
parent
commit
77defdddf0
  1. 3
      blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/CodeController.java
  2. 2
      blade-service/blade-flow/src/main/java/org/springblade/flowable/FlowApplication.java
  3. 3
      blade-service/blade-system/src/main/java/org/springblade/system/controller/AuthClientController.java
  4. 3
      blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java
  5. 3
      blade-service/blade-system/src/main/java/org/springblade/system/controller/DictController.java
  6. 3
      blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java
  7. 3
      blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java
  8. 4
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java
  9. 3
      blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java
  10. 0
      doc/nacos/blade-flow-dev.yaml

3
blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/CodeController.java

@ -22,7 +22,9 @@ import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.develop.entity.Code; import org.springblade.develop.entity.Code;
import org.springblade.develop.service.ICodeService; import org.springblade.develop.service.ICodeService;
@ -43,6 +45,7 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/code") @RequestMapping("/code")
@Api(value = "代码生成", tags = "代码生成") @Api(value = "代码生成", tags = "代码生成")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
public class CodeController extends BladeController { public class CodeController extends BladeController {
private ICodeService codeService; private ICodeService codeService;

2
blade-service/blade-flow/src/main/java/org/springblade/flowable/FlowApplication.java

@ -31,7 +31,7 @@ import org.springframework.cloud.client.SpringCloudApplication;
public class FlowApplication { public class FlowApplication {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(AppConstant.APPLICATION_FLOWABLE_NAME, FlowApplication.class, args); BladeApplication.run(AppConstant.APPLICATION_FLOW_NAME, FlowApplication.class, args);
} }
} }

3
blade-service/blade-system/src/main/java/org/springblade/system/controller/AuthClientController.java

@ -24,7 +24,9 @@ import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.AuthClient; import org.springblade.system.entity.AuthClient;
import org.springblade.system.service.IAuthClientService; import org.springblade.system.service.IAuthClientService;
@ -43,6 +45,7 @@ import javax.validation.Valid;
@RequestMapping("/client") @RequestMapping("/client")
@ApiIgnore @ApiIgnore
@Api(value = "应用管理", tags = "接口") @Api(value = "应用管理", tags = "接口")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
public class AuthClientController extends BladeController { public class AuthClientController extends BladeController {
private IAuthClientService clientService; private IAuthClientService clientService;

3
blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java

@ -22,8 +22,10 @@ import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.node.INode; import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
@ -46,6 +48,7 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/dept") @RequestMapping("/dept")
@Api(value = "部门", tags = "部门") @Api(value = "部门", tags = "部门")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public class DeptController extends BladeController { public class DeptController extends BladeController {
private IDeptService deptService; private IDeptService deptService;

3
blade-service/blade-system/src/main/java/org/springblade/system/controller/DictController.java

@ -20,7 +20,9 @@ import io.swagger.annotations.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.node.INode; import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dict; import org.springblade.system.entity.Dict;
@ -47,6 +49,7 @@ import static org.springblade.common.cache.CacheNames.DICT_VALUE;
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/dict") @RequestMapping("/dict")
@Api(value = "字典", tags = "字典") @Api(value = "字典", tags = "字典")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public class DictController extends BladeController { public class DictController extends BladeController {
private IDictService dictService; private IDictService dictService;

3
blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java

@ -21,7 +21,9 @@ import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.support.Kv; import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Menu; import org.springblade.system.entity.Menu;
@ -48,6 +50,7 @@ import static org.springblade.common.cache.CacheNames.AUTH_ROUTES;
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/menu") @RequestMapping("/menu")
@Api(value = "菜单", tags = "菜单") @Api(value = "菜单", tags = "菜单")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
public class MenuController extends BladeController { public class MenuController extends BladeController {
private IMenuService menuService; private IMenuService menuService;

3
blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java

@ -22,8 +22,10 @@ import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.node.INode; import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Role; import org.springblade.system.entity.Role;
@ -46,6 +48,7 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/role") @RequestMapping("/role")
@Api(value = "角色", tags = "角色") @Api(value = "角色", tags = "角色")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public class RoleController extends BladeController { public class RoleController extends BladeController {
private IRoleService roleService; private IRoleService roleService;

4
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java

@ -59,8 +59,8 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
public List<RoleVO> tree(String tenantCode) { public List<RoleVO> tree(String tenantCode) {
String userRole = SecureUtil.getUserRole(); String userRole = SecureUtil.getUserRole();
String excludeRole = null; String excludeRole = null;
if (!CollectionUtil.contains(Func.toStrArray(userRole), RoleConstant.ADMIN)) { if (!CollectionUtil.contains(Func.toStrArray(userRole), RoleConstant.ADMINISTRATOR)) {
excludeRole = RoleConstant.ADMIN; excludeRole = RoleConstant.ADMINISTRATOR;
} }
return ForestNodeMerger.merge(baseMapper.tree(tenantCode, excludeRole)); return ForestNodeMerger.merge(baseMapper.tree(tenantCode, excludeRole));
} }

3
blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java

@ -27,8 +27,10 @@ import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.feign.IDictClient; import org.springblade.system.feign.IDictClient;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
@ -49,6 +51,7 @@ import java.util.Map;
@RestController @RestController
@RequestMapping @RequestMapping
@AllArgsConstructor @AllArgsConstructor
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public class UserController { public class UserController {
private IUserService userService; private IUserService userService;

0
doc/nacos/blade-flowable-dev.yaml → doc/nacos/blade-flow-dev.yaml

Loading…
Cancel
Save