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 {
|
|
||||||
var roleStream = user.getRoleMappingsStream();
|
|
||||||
if (rolesSet == null) {
|
|
||||||
LOGGER.error("role stream is null");
|
|
||||||
}
|
|
||||||
roleStream.filter((r) -> {
|
|
||||||
var attr = r.getFirstAttribute("scim");
|
|
||||||
if (attr == null) {
|
|
||||||
LOGGER.debug("attribute is null");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return attr.equals("true");
|
|
||||||
}).map((r) -> r.getName()).forEach(r -> rolesSet.add(r));
|
|
||||||
|
|
||||||
// user.getRoleMappingsStream().filter((r) -> r.getFirstAttribute("scim").equals("true"))
|
user.getRoleMappingsStream().filter((r) -> {
|
||||||
// .map((r) -> r.getName()).forEach(r -> rolesSet.add(r));
|
var attr = r.getFirstAttribute("scim");
|
||||||
} catch (Exception e) {
|
if (attr == null) {
|
||||||
LOGGER.error(e);
|
return false;
|
||||||
}
|
}
|
||||||
|
return attr.equals("true");
|
||||||
|
}).map((r) -> r.getName()).forEach(r -> rolesSet.add(r));
|
||||||
|
|
||||||
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