Improve directory edition
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / directory / ldap / LdapHierarchyUnit.java
index 0e005133a10aec011b39316ba21567c85475ec3f..b60ee0c68935cc3e08248f1a69902b8d6aebe393 100644 (file)
@@ -39,6 +39,17 @@ public class LdapHierarchyUnit extends DefaultLdapEntry implements HierarchyUnit
                return getDirectoryDao().doGetDirectHierarchyUnits(getDn(), functionalOnly);
        }
 
+       @Override
+       public HierarchyUnit getDirectChild(Type type) {
+               return switch (type) {
+               case ROLES ->
+                       getDirectoryDao().doGetHierarchyUnit((LdapName) getDn().add(getDirectory().getSystemRoleBaseRdn()));
+               case PEOPLE -> getDirectoryDao().doGetHierarchyUnit((LdapName) getDn().add(getDirectory().getUserBaseRdn()));
+               case GROUPS -> getDirectoryDao().doGetHierarchyUnit((LdapName) getDn().add(getDirectory().getGroupBaseRdn()));
+               case FUNCTIONAL -> throw new IllegalArgumentException("Type must be a technical type");
+               };
+       }
+
        @Override
        public boolean isType(Type type) {
                return this.type.equals(type);