|
|
@ -3,12 +3,10 @@ package com.epmet.controller; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.RoleOpeScopeResultDTO; |
|
|
|
import com.epmet.service.AccessService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
/** |
|
|
@ -24,67 +22,6 @@ public class AccessController { |
|
|
|
@Autowired |
|
|
|
private AccessService accessService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新工作人员权限缓存(前端查询权限时候gov-mine会调用此处) |
|
|
|
* @param staffPermCacheFormDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("updatepermissioncache") |
|
|
|
public Result updatePermissionCache(@RequestBody StaffPermCacheFormDTO staffPermCacheFormDTO) { |
|
|
|
ValidatorUtils.validateEntity(staffPermCacheFormDTO, StaffPermCacheFormDTO.UpdatePermissionCache.class); |
|
|
|
String staffId = staffPermCacheFormDTO.getStaffId(); |
|
|
|
String app = staffPermCacheFormDTO.getApp(); |
|
|
|
String client = staffPermCacheFormDTO.getClient(); |
|
|
|
Set<String> permissions = staffPermCacheFormDTO.getPermissions(); |
|
|
|
Set<String> roleIdList = staffPermCacheFormDTO.getRoleIdList(); |
|
|
|
String orgId = staffPermCacheFormDTO.getOrgIdPath(); |
|
|
|
String gridId = staffPermCacheFormDTO.getGridId(); |
|
|
|
accessService.updatePermissionCache(staffId, app, client, permissions, roleIdList, orgId, gridId); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
///**
|
|
|
|
// * 从缓存中查询用户信息(DataFilterAspect中用到)
|
|
|
|
// * @return
|
|
|
|
// */
|
|
|
|
//@PostMapping("loginuserinfo")
|
|
|
|
//public Result<LoginUserInfoResultDTO> getLoginUserInfo(@RequestBody StaffPermCacheFormDTO dto) {
|
|
|
|
// ValidatorUtils.validateEntity(dto, StaffPermCacheFormDTO.GetStaffCurrPermissions.class);
|
|
|
|
// GovTokenDto govTokenDto = accessService.getUserDetails(dto.getApp(), dto.getClient(), dto.getStaffId());
|
|
|
|
// LoginUserInfoResultDTO resultDTO = null;
|
|
|
|
// if (govTokenDto != null) {
|
|
|
|
// resultDTO = new LoginUserInfoResultDTO();
|
|
|
|
// resultDTO.setRoleIdList(govTokenDto.getRoleIdList());
|
|
|
|
// //resultDTO.setGridId(govTokenDto.getGridId());
|
|
|
|
// resultDTO.setOrgIdPath(govTokenDto.getOrgIdPath());
|
|
|
|
// resultDTO.setGridIdList(govTokenDto.getGridIdList());
|
|
|
|
// resultDTO.setDeptIdList(govTokenDto.getDeptIdList());
|
|
|
|
// resultDTO.setUserId(govTokenDto.getUserId());
|
|
|
|
// }
|
|
|
|
// return new Result<LoginUserInfoResultDTO>().ok(resultDTO);
|
|
|
|
//}
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查询角色的操作key对应操作范围列表(缓存) |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("operationscopes") |
|
|
|
public Result<Set<RoleOpeScopeResultDTO>> getOperationScopesByRoleId(@RequestBody OperationScopeFormDTO operationScopeFormDTO) { |
|
|
|
ValidatorUtils.validateEntity(operationScopeFormDTO, OperationScopeFormDTO.ListOperationScopeGroup.class); |
|
|
|
Set<RoleOpeScopeResultDTO> scopes = accessService.listOperationScopesByRoleId(operationScopeFormDTO.getRoleId(), operationScopeFormDTO.getOperationKey()); |
|
|
|
return new Result<Set<RoleOpeScopeResultDTO>>().ok(scopes); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询角色所有operation及其范围(缓存) |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("roleallopesandscopes/{roleId}") |
|
|
|
public Result<List<RoleOpeScopeResultDTO>> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId) { |
|
|
|
List<RoleOpeScopeResultDTO> scopes = accessService.listAllRoleOperationScopesByRoleId(roleId); |
|
|
|
return new Result<List<RoleOpeScopeResultDTO>>().ok(scopes); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 用户是否具有指定功能权限 |
|
|
|
* @return |
|
|
|