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

修改初始化时没有role的bug

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