Browse Source

1.操作功能权限范围常量调整

dev_shibei_match
wxz 5 years ago
parent
commit
f686c2e919
  1. 5
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java
  2. 43
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

5
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java

@ -39,6 +39,11 @@ public class OperationScopeConstant {
//"本组织"
public static final String SCOPE_ORG_CURR = "org_curr";
//"本组织的上级"
public static final String SCOPE_ORG_CURR_SUP = "org_curr_sup";
//"本组织及上级"
public static final String SCOPE_ORG_CURR_AND_SUP = "org_curr_and_sup";
//我创建的
public static final String SCOPE_I_CREATED = "i_created";
//网格内

43
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

@ -3,7 +3,6 @@ package com.epmet.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.epmet.bean.OpeScopeFilterResultBean;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.OpeScopeConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
@ -175,7 +174,7 @@ public class AccessServiceImpl implements AccessService {
Set<String> switchScopes = effectiveOpeScopes.getSwitchScopes();
// 生成组织上下级关系系列的sql过滤片段
if (!CollectionUtil.isEmpty(orgLevelScopes) && !orgLevelScopes.contains(OpeScopeConstant.ORG_ALL)) {
if (!CollectionUtil.isEmpty(orgLevelScopes) && !orgLevelScopes.contains(OperationScopeConstant.SCOPE_ORG_ALL)) {
genOrgLevelScopeSqlFilter(sb, orgLevelScopes, userDetails.getOrgIdPath(), form.getTableAlias());
}
@ -316,7 +315,7 @@ public class AccessServiceImpl implements AccessService {
for (RoleOpeScopeResultDTO scope : scopeDTOS) {
if (OpeScopeConstant.ALL.equals(scope.getScopeKey())) {
if (OperationScopeConstant.SCOPE_ALL.equals(scope.getScopeKey())) {
all = true;
break;
}
@ -327,7 +326,7 @@ public class AccessServiceImpl implements AccessService {
}
String scopeIndex = scope.getScopeIndex();
if (OpeScopeConstant.ORG_ALL.equals(scope.getScopeKey())) {
if (OperationScopeConstant.SCOPE_ORG_ALL.equals(scope.getScopeKey())) {
// 该操作具有org_all的权限,直接放入
orgLevelScopes.put(scopeIndex, scope);
continue;
@ -378,7 +377,7 @@ public class AccessServiceImpl implements AccessService {
for (String scope : scopes) {
switch (scope) {
// 当前单位(可以用ORG_ID_PATH,也可以用ORG_ID判断)
case OpeScopeConstant.ORG_CURR:
case OperationScopeConstant.SCOPE_ORG_CURR:
if (StringUtils.isBlank(tableAlias)) {
sb.append(" ORG_ID_PATH = '").append(orgIdPath).append("' OR ");
//sb.append(" ORG_ID = '").append(currOrgID).append("' OR ");
@ -388,7 +387,7 @@ public class AccessServiceImpl implements AccessService {
}
break;
// 本单位及其子级单位
case OpeScopeConstant.ORG_CURR_AND_SUB:
case OperationScopeConstant.SCOPE_ORG_CURR_AND_SUB:
if (StringUtils.isBlank(tableAlias)) {
sb.append(" ORG_ID_PATH like '").append(orgIdPath).append("%' OR ");
} else {
@ -396,7 +395,7 @@ public class AccessServiceImpl implements AccessService {
}
break;
// 本单位的子级单位
case OpeScopeConstant.ORG_CURR_SUB:
case OperationScopeConstant.SCOPE_ORG_CURR_SUB:
if (StringUtils.isBlank(tableAlias)) {
sb.append(" ORG_ID_PATH like '").append(orgIdPath).append(":%' OR ");
} else {
@ -404,7 +403,7 @@ public class AccessServiceImpl implements AccessService {
}
break;
//当前单位的父级单位
case OpeScopeConstant.ORG_CURR_SUP:
case OperationScopeConstant.SCOPE_ORG_CURR_SUP:
if (StringUtils.isBlank(tableAlias)) {
sb.append(" '").append(orgIdPath).append("' like CONCAT(").append("ORG_ID_PATH,':%') OR ");
} else {
@ -412,30 +411,30 @@ public class AccessServiceImpl implements AccessService {
}
break;
// 当前单位及其父级单位
case OpeScopeConstant.ORG_CURR_AND_SUP:
case OperationScopeConstant.SCOPE_ORG_CURR_AND_SUP:
if (StringUtils.isBlank(tableAlias)) {
sb.append(" '").append(orgIdPath).append("' like CONCAT(").append("ORG_ID_PATH,'%') OR ");
} else {
sb.append(" '").append(orgIdPath).append("' like CONCAT(").append(tableAlias).append(".ORG_ID_PATH,'%' ) OR ");
}
break;
case OpeScopeConstant.ORG_EQUAL:
case OperationScopeConstant.SCOPE_ORG_EQUAL:
// todo 同级
//sb.append(" OR ");
break;
case OpeScopeConstant.ORG_EQUAL_AND_SUB:
case OperationScopeConstant.SCOPE_ORG_EQUAL_AND_SUB:
// todo 同级及其子级
//sb.append(" OR ");
break;
case OpeScopeConstant.ORG_EQUAL_SUB:
case OperationScopeConstant.SCOPE_ORG_EQUAL_SUB:
// todo 同级的子级
//sb.append(" OR ");
break;
case OpeScopeConstant.ORG_EQUAL_AND_SUP:
case OperationScopeConstant.SCOPE_ORG_EQUAL_AND_SUP:
// todo 同级及其上级
//sb.append(" OR ");
break;
case OpeScopeConstant.ORG_EQUAL_SUP:
case OperationScopeConstant.SCOPE_ORG_EQUAL_SUP:
// todo 同级的上级
//sb.append(" OR ");
break;
@ -539,7 +538,7 @@ public class AccessServiceImpl implements AccessService {
HashSet<String> opeKeys = new HashSet<>();
for (RoleOpeScopeResultDTO opeScope : roleOperations) {
String scopeKey = opeScope.getScopeKey();
if (OpeScopeConstant.ORG_ALL.equals(scopeKey) || OpeScopeConstant.ALL.equals(scopeKey)) {
if (OperationScopeConstant.SCOPE_ORG_ALL.equals(scopeKey) || OperationScopeConstant.SCOPE_ALL.equals(scopeKey)) {
// 如果该操作的范围是org_all或者all,不需要根据上下级关系判断,直接返回即可。
opeKeys.add(opeScope.getOperationKey());
continue;
@ -553,21 +552,21 @@ public class AccessServiceImpl implements AccessService {
switch (currOrgRelation) {
case ORG_RELATION_SAME:// 就在所在机构下
if (OpeScopeConstant.ORG_CURR.equals(scopeKey)
|| OpeScopeConstant.ORG_CURR_AND_SUB.equals(scopeKey)
|| OpeScopeConstant.ORG_CURR_AND_SUP.equals(scopeKey)) {
if (OperationScopeConstant.SCOPE_ORG_CURR.equals(scopeKey)
|| OperationScopeConstant.SCOPE_ORG_CURR_AND_SUB.equals(scopeKey)
|| OperationScopeConstant.SCOPE_ORG_CURR_AND_SUP.equals(scopeKey)) {
opeKeys.add(opeScope.getOperationKey());
}
break;
case ORG_RELATION_SUB:// 所在机构的子级
if (OpeScopeConstant.ORG_CURR_SUB.equals(scopeKey)
|| OpeScopeConstant.ORG_CURR_AND_SUB.equals(scopeKey)) {
if (OperationScopeConstant.SCOPE_ORG_CURR_SUB.equals(scopeKey)
|| OperationScopeConstant.SCOPE_ORG_CURR_AND_SUB.equals(scopeKey)) {
opeKeys.add(opeScope.getOperationKey());
}
break;
case ORG_RELATION_SUP:// 所在机构的上级
if (OpeScopeConstant.ORG_CURR_SUP.equals(scopeKey)
|| OpeScopeConstant.ORG_CURR_AND_SUP.equals(scopeKey)) {
if (OperationScopeConstant.SCOPE_ORG_CURR_SUP.equals(scopeKey)
|| OperationScopeConstant.SCOPE_ORG_CURR_AND_SUP.equals(scopeKey)) {
opeKeys.add(opeScope.getOperationKey());
}
break;

Loading…
Cancel
Save