You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
2.9 KiB
103 lines
2.9 KiB
package com.fanruan.api.decision; |
|
|
|
import com.fr.decision.authority.AuthorityContext; |
|
import com.fr.decision.authority.controller.CustomRoleController; |
|
import com.fr.decision.authority.controller.DefaultAuthorityController; |
|
import com.fr.decision.authority.controller.DepartmentController; |
|
import com.fr.decision.authority.controller.PostController; |
|
import com.fr.decision.authority.controller.UserController; |
|
import com.fr.decision.config.FSConfig; |
|
|
|
/** |
|
* @author richie |
|
* @version 10.0 |
|
* Created by richie on 2019-09-19 |
|
* 权限相关的工具类 |
|
*/ |
|
public class AuthorityKit { |
|
|
|
/** |
|
* 是否开启了分级权限 |
|
* |
|
* @return 开启返回true,关闭返回false |
|
*/ |
|
public static boolean isGradeAuthority() { |
|
return FSConfig.getInstance().getAuthorizeAttr().isGradeAuthority(); |
|
} |
|
|
|
/** |
|
* 是否开启了数据连接权限控制 |
|
* |
|
* @return 开启返回true,关闭返回false |
|
*/ |
|
public static boolean isDataConnectionAuthority() { |
|
return FSConfig.getInstance().getAuthorizeAttr().isDataConnectionAuthority(); |
|
} |
|
|
|
/** |
|
* 是否开启了目录编辑权限 |
|
* |
|
* @return 开启返回true,关闭返回false |
|
*/ |
|
public static boolean isEditReportAuthority() { |
|
return FSConfig.getInstance().getAuthorizeAttr().isEditReportAuthority(); |
|
} |
|
|
|
/** |
|
* 获取默认权限实体控制器 |
|
* |
|
* @return 权限实体控制器 |
|
*/ |
|
public static DefaultAuthorityController getAuthorityController() { |
|
return AuthorityContext.getInstance().getAuthorityController(); |
|
} |
|
|
|
/** |
|
* 获取扩展权限实体控制器 |
|
* |
|
* @param controllerInterface 权限数据记录的类对象 |
|
* @return 权限实体控制器 |
|
* @throws Exception 根据权限数据记录的类对象找不到对应的权限实体控制器则抛出此异常 |
|
*/ |
|
public static <T> T getAuthorityController(Class<T> controllerInterface) throws Exception { |
|
return AuthorityContext.getInstance().getAuthorityController(controllerInterface); |
|
} |
|
|
|
/** |
|
* 获取部门控制器 |
|
* |
|
* @return 部门控制器 |
|
*/ |
|
public static DepartmentController getDepartmentController() { |
|
return AuthorityContext.getInstance().getDepartmentController(); |
|
} |
|
|
|
/** |
|
* 获取职务控制器 |
|
* |
|
* @return 职务控制器 |
|
*/ |
|
public static PostController getPostController() { |
|
return AuthorityContext.getInstance().getPostController(); |
|
} |
|
|
|
/** |
|
* 获取自定义角色控制器 |
|
* |
|
* @return 自定义角色控制器 |
|
*/ |
|
public static CustomRoleController getCustomRoleController() { |
|
return AuthorityContext.getInstance().getCustomRoleController(); |
|
} |
|
|
|
/** |
|
* 获取用户控制器 |
|
* |
|
* @return 用户控制器 |
|
*/ |
|
public static UserController getUserController() { |
|
return AuthorityContext.getInstance().getUserController(); |
|
} |
|
|
|
|
|
}
|
|
|