X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FOsUserDirectory.java;h=3ded7a7a6a6ce28cfd277663b6efbb9e238a4810;hb=cceead8a279e8630f63cc9e8213bdcdca39955a5;hp=b0a52626aa4cda31602e18b37ae8208804600d2e;hpb=eb4324be6ac9cdff15828a21ee7d3f6ca2f19fb9;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 b0a52626a..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 + "," + getUserBaseRdn() + "," + 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<>(); + } + }