提交 19a63ad7 编写于 作者: sq3536's avatar sq3536

修改初始化时没有role的bug

上级 f6779f86
......@@ -84,15 +84,18 @@ public class UAACoreService {
userRoleService.selectByUserid(userId).forEach(sysUserRole -> roleIds.add(sysUserRole.getRoleid()));
roleIds.forEach(roleid->authorities.add(new SimpleGrantedAuthority("ROLE_"+roleid)));
SysRolePermissionSearchContext context = new SysRolePermissionSearchContext();
context.getSelectCond().in("sys_roleid",roleIds).eq("permissionenable",1).orderByAsc("permissiontype","sys_permissionid");
context.setSize(Integer.MAX_VALUE);
rolePermissionService.searchDefault(context).forEach(sysRolePermission -> {
if(PermissionType.OPPRIV.toString().equals(sysRolePermission.getPermissiontype()))
authorities.add(new SimpleGrantedAuthority(sysRolePermission.getPermissionid()));
else
authorities.add(new SimpleGrantedAuthority(sysRolePermission.getPermissiontype()+"_"+sysRolePermission.getPermissionid()));
});
if(roleIds.size()>0){
SysRolePermissionSearchContext context = new SysRolePermissionSearchContext();
context.getSelectCond().in("sys_roleid",roleIds).eq("permissionenable",1).orderByAsc("permissiontype","sys_permissionid");
context.setSize(Integer.MAX_VALUE);
rolePermissionService.searchDefault(context).forEach(sysRolePermission -> {
if(PermissionType.OPPRIV.toString().equals(sysRolePermission.getPermissiontype()))
authorities.add(new SimpleGrantedAuthority(sysRolePermission.getPermissionid()));
else
authorities.add(new SimpleGrantedAuthority(sysRolePermission.getPermissiontype()+"_"+sysRolePermission.getPermissionid()));
});
}
return authorities;
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册