权限获取

Integer userId = SecurityUtils.getUser().getId();
GdsUser user = SecurityUtils.getUser();
List<String> roleIdList = user.getAuthorities()
.stream().map(GrantedAuthority::getAuthority)
.filter(authority -> authority.startsWith(SecurityConstants.ROLE))
.map(authority -> authority.split(StrUtil.UNDERLINE)[1])
.collect(Collectors.toList());

/**
* 远程数据权限调用接口
*/
@FeignClient(contextId = "remoteDataScopeService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteDataScopeService {

/**
* 通过角色ID 查询角色列表
*
* @param roleIdList 角色ID
* @return
*/
@PostMapping("/role/getRoleList")
R<List<SysRole>> getRoleList(@RequestBody List<String> roleIdList);

/**
* 获取子级部门
*
* @param deptId 部门ID
* @return
*/
@GetMapping("/dept/getDescendantList/{deptId}")
R<List<SysDeptRelation>> getDescendantList(@PathVariable("deptId") Integer deptId);
}
//不是微服务
@Resource
private HttpSessionService httpSessionService;
posted @ 2022-05-31 11:44  全琪俊  阅读(138)  评论(0编辑  收藏  举报