Introduce directory kinds.
[lgpl/argeo-commons.git] / org.argeo.util / src / org / argeo / osgi / useradmin / LdapNameUtils.java
index f76d9441b9a5613799f4bd659faa87cf2553593b..7e763456a54cb846097ec12ff40b6cc55636c3cf 100644 (file)
@@ -31,6 +31,13 @@ class LdapNameUtils {
                }
        }
 
+       static Rdn getParentRdn(LdapName dn) {
+               if (dn.size() < 2)
+                       throw new IllegalArgumentException(dn + " has no parent");
+               Rdn parentRdn = dn.getRdn(dn.size() - 2);
+               return parentRdn;
+       }
+
        static LdapName toLdapName(String distinguishedName) {
                try {
                        return new LdapName(distinguishedName);