权限获取

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 @   全琪俊  阅读(152)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
· PowerShell开发游戏 · 打蜜蜂
点击右上角即可分享
微信分享提示