X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.enterprise%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FAggregatingUserAdmin.java;h=66d46d4e94c2acfe3cdb1807bea2ac0b00e018fd;hb=9ec85110269f8be5c83ea26e283359bb451a67b7;hp=6f353f155c5c620e9c0e24de4e260fb24165c797;hpb=2b6597a096ac21375aa83f86d1f750061b20387c;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.enterprise/src/org/argeo/osgi/useradmin/AggregatingUserAdmin.java b/org.argeo.enterprise/src/org/argeo/osgi/useradmin/AggregatingUserAdmin.java index 6f353f155..66d46d4e9 100644 --- a/org.argeo.enterprise/src/org/argeo/osgi/useradmin/AggregatingUserAdmin.java +++ b/org.argeo.enterprise/src/org/argeo/osgi/useradmin/AggregatingUserAdmin.java @@ -110,7 +110,12 @@ public class AggregatingUserAdmin implements UserAdmin { Set sysRoles = new HashSet(); for (String role : rawAuthorization.getRoles()) { Authorization auth = systemRoles.getAuthorization((User) userAdmin.getRole(role)); - sysRoles.addAll(Arrays.asList(auth.getRoles())); + systemRoles: for (String systemRole : auth.getRoles()) { + if (role.equals(systemRole)) + continue systemRoles; + sysRoles.add(systemRole); + } +// sysRoles.addAll(Arrays.asList(auth.getRoles())); } addAbstractSystemRoles(rawAuthorization, sysRoles); Authorization authorization = new AggregatingAuthorization(usernameToUse, displayNameToUse, sysRoles, @@ -164,12 +169,22 @@ public class AggregatingUserAdmin implements UserAdmin { return systemRoles; if (tokensBaseDn != null && name.startsWith(tokensBaseDn)) return tokens; - List res = new ArrayList(1); - for (LdapName baseDn : businessRoles.keySet()) { + List res = new ArrayList<>(1); + userDirectories: for (LdapName baseDn : businessRoles.keySet()) { + AbstractUserDirectory userDirectory = businessRoles.get(baseDn); if (name.startsWith(baseDn)) { - AbstractUserDirectory ud = businessRoles.get(baseDn); - if (!ud.isDisabled()) - res.add(ud); + if (userDirectory.isDisabled()) + continue userDirectories; +// if (res.isEmpty()) { + res.add(userDirectory); +// } else { +// for (AbstractUserDirectory ud : res) { +// LdapName bd = ud.getBaseDn(); +// if (userDirectory.getBaseDn().startsWith(bd)) { +// // child user directory +// } +// } +// } } } if (res.size() == 0)