diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAdd4RoletFormDTO.java similarity index 87% rename from epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java rename to epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAdd4RoletFormDTO.java index cf458aa878..85b9e9d68d 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAdd4RoletFormDTO.java @@ -6,7 +6,7 @@ import javax.validation.constraints.NotBlank; import java.util.List; @Data -public class AccessConfigAsyncDefaultFormDTO { +public class AccessConfigAdd4RoletFormDTO { @NotBlank(message = "角色Key不能为空") private String roleKey; diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java index 39d1305138..76a7886947 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java @@ -118,19 +118,19 @@ public class AccessConfigController { } /** - * @Description 将默认的角色操作和范围同步给具体的角色 + * @Description 给角色添加操作权限和操作范围 * @return * @author wxz * @date 2020.11.17 17:41 */ - @PostMapping("role-ope-and-scopes/async-from-default") - public Result asyncRoleOpeAndScopesFromDefault(@RequestBody AccessConfigAsyncDefaultFormDTO form ) { + @PostMapping("add-ope-and-scopes-4role") + public Result addOpeAndScopes4Role(@RequestBody AccessConfigAdd4RoletFormDTO form) { ValidatorUtils.validateEntity(form); String roleKey = form.getRoleKey(); String operationKey = form.getOperationKey(); List scopeKeys = form.getScopeKeys(); - accessConfigService.asyncRoleOpeAndScopesFromDefault(roleKey, operationKey, scopeKeys); + accessConfigService.addOpeAndScopes4Role(roleKey, operationKey, scopeKeys); return new Result(); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java index 2c2c1518d3..508f3ad45f 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java @@ -26,5 +26,5 @@ public interface AccessConfigService { void saveOpeDefaultScopes(String roleKey, String operationKey, List scopeKeys); - void asyncRoleOpeAndScopesFromDefault(String roleKey, String operationKey, List scopeKeys); + void addOpeAndScopes4Role(String roleKey, String operationKey, List scopeKeys); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java index bc53201ce0..79d35436a8 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java @@ -203,13 +203,13 @@ public class AccessConfigServiceImpl implements AccessConfigService { } /** - * @Description 将默认的角色操作和范围同步给具体的角色 + * @Description 给角色添加操作权限和操作范围 * @return * @author wxz * @date 2020.11.17 17:41 */ @Override - public void asyncRoleOpeAndScopesFromDefault(String roleKey, String operationKey, List scopeKeys) { + public void addOpeAndScopes4Role(String roleKey, String operationKey, List scopeKeys) { Result> rolesResult = epmetUserOpenFeignClient.listRolesByRoleKey(roleKey); if (!rolesResult.success()) { String msg = "调用user服务,根据key查询角色列表失败"; @@ -219,7 +219,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { List roles = rolesResult.getData(); List roleIds2Add = roles.stream().map(GovStaffRoleResultDTO::getRoleId).collect(Collectors.toList()); - asyncRoleOpeAndScopesFromDefault(roleIds2Add, operationKey, scopeKeys); + addOpeAndScopes4Role(roleIds2Add, operationKey, scopeKeys); } /** @@ -229,7 +229,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { * @date 2020.11.17 17:38 */ @Transactional(rollbackFor = Exception.class) - public void asyncRoleOpeAndScopesFromDefault(List roleIds, String operationKey, List scopeKeys) { + public void addOpeAndScopes4Role(List roleIds, String operationKey, List scopeKeys) { for (String roleId : roleIds) { // 只给没有添加该权限的用户赋予该权限,已经添加了和添加了又取消的不操作 RoleOperationEntity roleOpe = roleOperationDao.getRoleOpe(roleId, operationKey);