fix role mapping
This commit is contained in:
parent
67084d699a
commit
a0958f728d
1 changed files with 8 additions and 19 deletions
|
@ -100,26 +100,15 @@ public class UserAdapter extends Adapter<UserModel, UserResource> {
|
||||||
user.getGroupsStream().flatMap(g -> g.getRoleMappingsStream())
|
user.getGroupsStream().flatMap(g -> g.getRoleMappingsStream())
|
||||||
.filter((r) -> r.getFirstAttribute("scim").equals("true")).map((r) -> r.getName())
|
.filter((r) -> r.getFirstAttribute("scim").equals("true")).map((r) -> r.getName())
|
||||||
.forEach(r -> rolesSet.add(r));
|
.forEach(r -> rolesSet.add(r));
|
||||||
// Bug when new user.
|
|
||||||
try {
|
user.getRoleMappingsStream().filter((r) -> {
|
||||||
var roleStream = user.getRoleMappingsStream();
|
|
||||||
if (rolesSet == null) {
|
|
||||||
LOGGER.error("role stream is null");
|
|
||||||
}
|
|
||||||
roleStream.filter((r) -> {
|
|
||||||
var attr = r.getFirstAttribute("scim");
|
var attr = r.getFirstAttribute("scim");
|
||||||
if (attr == null) {
|
if (attr == null) {
|
||||||
LOGGER.debug("attribute is null");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return attr.equals("true");
|
return attr.equals("true");
|
||||||
}).map((r) -> r.getName()).forEach(r -> rolesSet.add(r));
|
}).map((r) -> r.getName()).forEach(r -> rolesSet.add(r));
|
||||||
|
|
||||||
// user.getRoleMappingsStream().filter((r) -> r.getFirstAttribute("scim").equals("true"))
|
|
||||||
// .map((r) -> r.getName()).forEach(r -> rolesSet.add(r));
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error(e);
|
|
||||||
}
|
|
||||||
var roles = new String[rolesSet.size()];
|
var roles = new String[rolesSet.size()];
|
||||||
rolesSet.toArray(roles);
|
rolesSet.toArray(roles);
|
||||||
setRoles(roles);
|
setRoles(roles);
|
||||||
|
|
Loading…
Reference in a new issue