X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2Fdirectory%2Fldap%2FAbstractLdapDirectory.java;h=74dd15edec4c658ca9df5af3a3446e7b0cb1cf4e;hb=3a0104e8ee69269ce6ad35471182c2c1fe003f95;hp=54d9776b5fd15106bf6de8b560ef81f863f1d470;hpb=285c23f26c4d634cd139d393ebcb708187d5e960;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/util/directory/ldap/AbstractLdapDirectory.java b/org.argeo.util/src/org/argeo/util/directory/ldap/AbstractLdapDirectory.java index 54d9776b5..74dd15ede 100644 --- a/org.argeo.util/src/org/argeo/util/directory/ldap/AbstractLdapDirectory.java +++ b/org.argeo.util/src/org/argeo/util/directory/ldap/AbstractLdapDirectory.java @@ -10,6 +10,7 @@ import java.util.Dictionary; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; +import java.util.Locale; import java.util.Optional; import java.util.StringJoiner; @@ -255,10 +256,6 @@ public abstract class AbstractLdapDirectory implements Directory, XAResourceProv } else { // user doesn't have the right to retrieve role, but we know it exists // otherwise memberOf would not work -// Attributes a = new BasicAttributes(); -// a.put(LdapNameUtils.getLastRdn(groupDn).getType(), -// LdapNameUtils.getLastRdn(groupDn).getValue()); -// a.put(LdapAttrs.objectClass.name(), LdapObjs.groupOfNames.name()); group = newGroup(groupDn); allRoles.add(group); } @@ -300,6 +297,16 @@ public abstract class AbstractLdapDirectory implements Directory, XAResourceProv return getName(); } + @Override + public String getHierarchyUnitLabel(Locale locale) { + String key = LdapNameUtils.getLastRdn(getBaseDn()).getType(); + Object value = LdapEntry.getLocalized(asLdapEntry().getProperties(), key, locale); + if (value == null) + value = getHierarchyUnitName(); + assert value != null; + return value.toString(); + } + @Override public HierarchyUnit getParent() { return null; @@ -386,7 +393,7 @@ public abstract class AbstractLdapDirectory implements Directory, XAResourceProv } return name; } catch (InvalidNameException e) { - throw new IllegalStateException("Cannot get role " + path, e); + throw new IllegalStateException("Cannot convert " + path + " to LDAP name", e); } }