X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FOsUserDirectory.java;h=3ded7a7a6a6ce28cfd277663b6efbb9e238a4810;hb=00ca9fa781f633e369fd3a66b75368857c396339;hp=329da91499165170ebb043dcf53cf938b6f20192;hpb=ddc70245fe7413b7341205914c91015600726b4a;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/osgi/useradmin/OsUserDirectory.java b/org.argeo.util/src/org/argeo/osgi/useradmin/OsUserDirectory.java index 329da9149..3ded7a7a6 100644 --- a/org.argeo.util/src/org/argeo/osgi/useradmin/OsUserDirectory.java +++ b/org.argeo.util/src/org/argeo/osgi/useradmin/OsUserDirectory.java @@ -15,6 +15,7 @@ import org.argeo.util.naming.LdapAttrs; import org.osgi.framework.Filter; import org.osgi.service.useradmin.User; +/** Pseudo user directory to be used when logging in as OS user. */ public class OsUserDirectory extends AbstractUserDirectory { private final String osUsername = System.getProperty("user.name"); private final LdapName osUserDn; @@ -23,12 +24,13 @@ public class OsUserDirectory extends AbstractUserDirectory { public OsUserDirectory(URI uriArg, Dictionary props) { super(uriArg, props, false); try { - osUserDn = new LdapName(LdapAttrs.uid.name() + "=" + osUsername + "," + getUserBase() + "," + getBaseDn()); + osUserDn = new LdapName( + LdapAttrs.uid.name() + "=" + osUsername + "," + getUserBaseRdn() + "," + getBaseDn()); Attributes attributes = new BasicAttributes(); attributes.put(LdapAttrs.uid.name(), osUsername); osUser = newUser(osUserDn, attributes); } catch (NamingException e) { - throw new UserDirectoryException("Cannot create system user", e); + throw new IllegalStateException("Cannot create system user", e); } } @@ -63,4 +65,14 @@ public class OsUserDirectory extends AbstractUserDirectory { throw new UnsupportedOperationException(); } + @Override + protected HierarchyUnit doGetHierarchyUnit(LdapName dn) { + return null; + } + + @Override + protected Iterable doGetDirectHierarchyUnits(LdapName searchBase, boolean functionalOnly) { + return new ArrayList<>(); + } + }