use of org.jeecg.common.aspect.annotation.PermissionData in project kms by mahonelau.
the class PermissionDataAspect method arround.
@Around("pointCut()")
public Object arround(ProceedingJoinPoint point) throws Throwable {
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod();
PermissionData pd = method.getAnnotation(PermissionData.class);
String component = pd.pageComponent();
String requestMethod = request.getMethod();
String requestPath = request.getRequestURI().substring(request.getContextPath().length());
requestPath = filterUrl(requestPath);
log.debug("拦截请求 >> " + requestPath + ";请求类型 >> " + requestMethod);
String username = JwtUtil.getUserNameByToken(request);
// 查询数据权限信息
// TODO 微服务情况下也得支持缓存机制
List<SysPermissionDataRuleModel> dataRules = commonAPI.queryPermissionDataRule(component, requestPath, username);
if (dataRules != null && dataRules.size() > 0) {
// 临时存储
JeecgDataAutorUtils.installDataSearchConditon(request, dataRules);
// TODO 微服务情况下也得支持缓存机制
SysUserCacheInfo userinfo = commonAPI.getCacheUser(username);
JeecgDataAutorUtils.installUserInfo(request, userinfo);
}
return point.proceed();
}
use of org.jeecg.common.aspect.annotation.PermissionData in project jeecg-boot by jeecgboot.
the class PermissionDataAspect method arround.
@Around("pointCut()")
public Object arround(ProceedingJoinPoint point) throws Throwable {
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod();
PermissionData pd = method.getAnnotation(PermissionData.class);
String component = pd.pageComponent();
String requestMethod = request.getMethod();
String requestPath = request.getRequestURI().substring(request.getContextPath().length());
requestPath = filterUrl(requestPath);
// TODO 参数顺序调整有隐患
if (requestPath.indexOf(UrlMatchEnum.CGREPORT_DATA.getMatch_url()) >= 0) {
// 获取地址栏参数
String urlParamString = request.getParameter(CommonConstant.ONL_REP_URL_PARAM_STR);
if (oConvertUtils.isNotEmpty(urlParamString)) {
requestPath += "?" + urlParamString;
}
}
// update-end-author:taoyan date:20211027 for:JTC-132【online报表权限】online报表带参数的菜单配置数据权限无效
log.info("拦截请求 >> {} ; 请求类型 >> {} . ", requestPath, requestMethod);
String username = JwtUtil.getUserNameByToken(request);
// 查询数据权限信息
// TODO 微服务情况下也得支持缓存机制
List<SysPermissionDataRuleModel> dataRules = commonAPI.queryPermissionDataRule(component, requestPath, username);
if (dataRules != null && dataRules.size() > 0) {
// 临时存储
JeecgDataAutorUtils.installDataSearchConditon(request, dataRules);
// TODO 微服务情况下也得支持缓存机制
SysUserCacheInfo userinfo = commonAPI.getCacheUser(username);
JeecgDataAutorUtils.installUserInfo(request, userinfo);
}
return point.proceed();
}
use of org.jeecg.common.aspect.annotation.PermissionData in project kykms by mahonelau.
the class PermissionDataAspect method arround.
@Around("pointCut()")
public Object arround(ProceedingJoinPoint point) throws Throwable {
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod();
PermissionData pd = method.getAnnotation(PermissionData.class);
String component = pd.pageComponent();
String requestMethod = request.getMethod();
String requestPath = request.getRequestURI().substring(request.getContextPath().length());
requestPath = filterUrl(requestPath);
log.debug("拦截请求 >> " + requestPath + ";请求类型 >> " + requestMethod);
String username = JwtUtil.getUserNameByToken(request);
// 查询数据权限信息
// TODO 微服务情况下也得支持缓存机制
List<SysPermissionDataRuleModel> dataRules = commonAPI.queryPermissionDataRule(component, requestPath, username);
if (dataRules != null && dataRules.size() > 0) {
// 临时存储
JeecgDataAutorUtils.installDataSearchConditon(request, dataRules);
// TODO 微服务情况下也得支持缓存机制
SysUserCacheInfo userinfo = commonAPI.getCacheUser(username);
JeecgDataAutorUtils.installUserInfo(request, userinfo);
}
return point.proceed();
}
Aggregations