org.jeecg.common.system.util.JeecgDataAutorUtils Java Examples

The following examples show how to use org.jeecg.common.system.util.JeecgDataAutorUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QueryGenerator.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 获取请求对应的数据权限规则
 * @return
 */
public static Map<String, SysPermissionDataRuleModel> getRuleMap() {
	Map<String, SysPermissionDataRuleModel> ruleMap = new HashMap<String, SysPermissionDataRuleModel>();
	List<SysPermissionDataRuleModel> list =JeecgDataAutorUtils.loadDataSearchConditon();
	if(list != null&&list.size()>0){
		if(list.get(0)==null){
			return ruleMap;
		}
		for (SysPermissionDataRuleModel rule : list) {
			String column = rule.getRuleColumn();
			if(QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
				column = SQL_RULES_COLUMN+rule.getId();
			}
			ruleMap.put(column, rule);
		}
	}
	return ruleMap;
}
 
Example #2
Source File: QueryGenerator.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 
 * @return
 */
public static Map<String, SysPermissionDataRule> getRuleMap() {
	Map<String, SysPermissionDataRule> ruleMap = new HashMap<String, SysPermissionDataRule>();
	List<SysPermissionDataRule> list =JeecgDataAutorUtils.loadDataSearchConditon();
	if(list != null&&list.size()>0){
		if(list.get(0)==null){
			return ruleMap;
		}
		for (SysPermissionDataRule rule : list) {
			String column = rule.getRuleColumn();
			if(QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
				column = SQL_RULES_COLUMN+rule.getId();
			}
			ruleMap.put(column, rule);
		}
	}
	return ruleMap;
}
 
Example #3
Source File: QueryGenerator.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 获取请求对应的数据权限规则
 * @return
 */
public static Map<String, SysPermissionDataRuleModel> getRuleMap() {
	Map<String, SysPermissionDataRuleModel> ruleMap = new HashMap<String, SysPermissionDataRuleModel>();
	List<SysPermissionDataRuleModel> list =JeecgDataAutorUtils.loadDataSearchConditon();
	if(list != null&&list.size()>0){
		if(list.get(0)==null){
			return ruleMap;
		}
		for (SysPermissionDataRuleModel rule : list) {
			String column = rule.getRuleColumn();
			if(QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
				column = SQL_RULES_COLUMN+rule.getId();
			}
			ruleMap.put(column, rule);
		}
	}
	return ruleMap;
}
 
Example #4
Source File: QueryGenerator.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 获取请求对应的数据权限规则
 * @return
 */
public static Map<String, SysPermissionDataRuleModel> getRuleMap() {
	Map<String, SysPermissionDataRuleModel> ruleMap = new HashMap<String, SysPermissionDataRuleModel>();
	List<SysPermissionDataRuleModel> list =JeecgDataAutorUtils.loadDataSearchConditon();
	if(list != null&&list.size()>0){
		if(list.get(0)==null){
			return ruleMap;
		}
		for (SysPermissionDataRuleModel rule : list) {
			String column = rule.getRuleColumn();
			if(QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
				column = SQL_RULES_COLUMN+rule.getId();
			}
			ruleMap.put(column, rule);
		}
	}
	return ruleMap;
}
 
Example #5
Source File: PermissionDataAspect.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
private void authDataHandler(HttpServletRequest request, String component) {
	List<SysPermission> currentSyspermission = null;
	if(oConvertUtils.isNotEmpty(component)) {
		//1.通过注解属性pageComponent 获取菜单
		currentSyspermission = sysUserRemoteApi.queryComponentPermission(component);
	}else {
		String requestMethod = request.getMethod();
		String requestPath = request.getRequestURI().substring(request.getContextPath().length());
		requestPath = filterUrl(requestPath);
		log.info("拦截请求 >> "+requestPath+";请求类型 >> "+requestMethod);
		currentSyspermission = sysUserRemoteApi.queryRequestPermission(requestMethod, requestPath);
	}
	//3.通过用户名+菜单ID 找到权限配置信息 放到request中去
	if(currentSyspermission!=null && currentSyspermission.size()>0) {
		String username = JwtUtil.getUserNameByToken(request);
		List<SysPermissionDataRuleModel> dataRules = new ArrayList<SysPermissionDataRuleModel>();
		for (SysPermission sysPermission : currentSyspermission) {
			// update-begin--Author:scott Date:20191119 for:数据权限规则编码不规范,项目存在相同包名和类名 #722
			List<SysPermissionDataRule> temp = sysUserRemoteApi.queryUserDataRule(username, sysPermission.getId());
			if(temp!=null && temp.size()>0) {
				//dataRules.addAll(temp);
				dataRules = oConvertUtils.entityListToModelList(temp,SysPermissionDataRuleModel.class);
			}
			// update-end--Author:scott Date:20191119 for:数据权限规则编码不规范,项目存在相同包名和类名 #722
		}
		if(dataRules!=null && dataRules.size()>0) {
			JeecgDataAutorUtils.installDataSearchConditon(request, dataRules);
			SysUserCacheInfo userinfo = sysUserRemoteApi.getCacheUser(username);
			JeecgDataAutorUtils.installUserInfo(request, userinfo);
		}
	}
}