Browse Source

版本升级:前端查询权限,增加all所有权限的条目

dev
wxz 5 years ago
parent
commit
68e98e231e
  1. 83
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java
  2. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/OpeScopeConstant.java
  3. 2
      epmet-module/gov-mine/gov-mine-server/pom.xml
  4. 9
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

83
epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java

@ -409,87 +409,4 @@ public class DataFilterAspect {
} }
return scopeStrs; return scopeStrs;
} }
/**
* 模拟范围数据
*
* @return
*/
private Set<OperationScopeDTO> genScopeDtos() {
OperationScopeDTO scopeDTO1 = new OperationScopeDTO();
scopeDTO1.setScopeKey("org_curr");
scopeDTO1.setScopeName("本机关");
scopeDTO1.setScopeIndex("ac_0");
OperationScopeDTO scopeDTO2 = new OperationScopeDTO();
scopeDTO2.setScopeKey("org_curr_and_sub");
scopeDTO2.setScopeName("本机关及下级");
scopeDTO2.setScopeIndex("ac_501");
OperationScopeDTO scopeDTO3 = new OperationScopeDTO();
scopeDTO3.setScopeKey("org_curr_sub");
scopeDTO3.setScopeName("本机关的下级");
scopeDTO3.setScopeIndex("ac_502");
OperationScopeDTO scopeDTO4 = new OperationScopeDTO();
scopeDTO4.setScopeKey("org_equal_and_sub");
scopeDTO4.setScopeName("同级机关及下级");
scopeDTO4.setScopeIndex("ae_601");
OperationScopeDTO scopeDTO5 = new OperationScopeDTO();
scopeDTO5.setScopeKey("org_equal_sub");
scopeDTO5.setScopeName("同级机关的下级");
scopeDTO5.setScopeIndex("ae_602");
Set<OperationScopeDTO> scopeDTOS = new HashSet<>();
scopeDTOS.add(scopeDTO1);
scopeDTOS.add(scopeDTO2);
scopeDTOS.add(scopeDTO3);
scopeDTOS.add(scopeDTO4);
scopeDTOS.add(scopeDTO5);
return scopeDTOS;
}
///**
// * 获取数据过滤的SQL
// */
//@Deprecated
//private String getSqlFilter(UserDetail user, JoinPoint point){
// MethodSignature signature = (MethodSignature) point.getSignature();
// DataFilter dataFilter = signature.getMethod().getAnnotation(DataFilter.class);
// //获取表的别名
// String tableAlias = dataFilter.tableAlias();
// if(StringUtils.isNotBlank(tableAlias)){
// tableAlias += ".";
// }
//
// StringBuilder sqlFilter = new StringBuilder();
//
// //查询条件前缀
// String prefix = dataFilter.prefix();
// if(StringUtils.isNotBlank(prefix)){
// sqlFilter.append(" ").append(prefix);
// }
//
// sqlFilter.append(" (");
//
// //部门ID列表
// List<Long> deptIdList = user.getDeptIdList();
// if(CollUtil.isNotEmpty(deptIdList)){
// sqlFilter.append(tableAlias).append(dataFilter.deptId());
//
// sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")");
// }
//
// //查询本人数据
// if (dataFilter.isPendingCreator()) {
// if(CollUtil.isNotEmpty(deptIdList)){
// sqlFilter.append(" or ");
// }
// sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId());
// }
// sqlFilter.append(")");
//
// return sqlFilter.toString();
//}
} }

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/OpeScopeConstant.java

@ -1,6 +1,10 @@
package com.epmet.commons.tools.constant; package com.epmet.commons.tools.constant;
public class OpeScopeConstant { public class OpeScopeConstant {
// 权限覆盖所有范围
public static final String ORG_ALL = "org_all";
//"同级组织的下级" //"同级组织的下级"
public static final String ORG_EQUAL_SUB = "org_equal_sub"; public static final String ORG_EQUAL_SUB = "org_equal_sub";
//"同级组织及下级" //"同级组织及下级"

2
epmet-module/gov-mine/gov-mine-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>0.3.4</version> <version>0.3.5</version>
<parent> <parent>
<groupId>com.epmet</groupId> <groupId>com.epmet</groupId>
<artifactId>gov-mine</artifactId> <artifactId>gov-mine</artifactId>

9
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

@ -115,8 +115,13 @@ public class AccessServiceImpl implements AccessService {
*/ */
private HashSet<String> filterOpesByScope(String currOrgRelation, Set<RoleOpeScopeResultDTO> roleOperations) { private HashSet<String> filterOpesByScope(String currOrgRelation, Set<RoleOpeScopeResultDTO> roleOperations) {
HashSet<String> opeKeys = new HashSet<>(); HashSet<String> opeKeys = new HashSet<>();
roleOperations.stream().forEach(opeScope -> { for (RoleOpeScopeResultDTO opeScope : roleOperations) {
String scopeKey = opeScope.getScopeKey(); String scopeKey = opeScope.getScopeKey();
if (OpeScopeConstant.ORG_ALL.equals(scopeKey)) {
// 如果该操作的范围是org_all,那就具有所有范围的该操作权限,不需要根据上下级关系判断
opeKeys.add(opeScope.getOperationKey());
continue;
}
switch (currOrgRelation) { switch (currOrgRelation) {
case ORG_RELATION_SAME:// 就在所在机构下 case ORG_RELATION_SAME:// 就在所在机构下
if (OpeScopeConstant.ORG_CURR.equals(scopeKey) if (OpeScopeConstant.ORG_CURR.equals(scopeKey)
@ -138,7 +143,7 @@ public class AccessServiceImpl implements AccessService {
} }
break; break;
} }
}); }
return opeKeys; return opeKeys;
} }

Loading…
Cancel
Save