X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FOsUserDirectory.java;h=5d7e97ddeea487975ebd64609f63167a0720656d;hb=3c1cdc594d954520b14646102b366290bdad58c7;hp=1adc7e0dfe6f1806b0b7186a8a5ef2d75e6aa5f7;hpb=dc27b57704278684e72efcaf72b01c5b91df39f8;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 1adc7e0df..5d7e97dde 100644 --- a/org.argeo.util/src/org/argeo/osgi/useradmin/OsUserDirectory.java +++ b/org.argeo.util/src/org/argeo/osgi/useradmin/OsUserDirectory.java @@ -6,7 +6,6 @@ import java.util.List; import javax.naming.NameNotFoundException; import javax.naming.NamingException; import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttributes; import javax.naming.ldap.LdapName; import org.argeo.util.directory.HierarchyUnit; @@ -27,9 +26,9 @@ public class OsUserDirectory extends AbstractLdapDirectoryDao { try { osUserDn = new LdapName(LdapAttrs.uid.name() + "=" + osUsername + "," + directory.getUserBaseRdn() + "," + directory.getBaseDn()); - Attributes attributes = new BasicAttributes(); - attributes.put(LdapAttrs.uid.name(), osUsername); - osUser = newUser(osUserDn, attributes); +// Attributes attributes = new BasicAttributes(); +// attributes.put(LdapAttrs.uid.name(), osUsername); + osUser = newUser(osUserDn); } catch (NamingException e) { throw new IllegalStateException("Cannot create system user", e); } @@ -41,12 +40,17 @@ public class OsUserDirectory extends AbstractLdapDirectoryDao { } @Override - public Boolean daoHasEntry(LdapName dn) { + public boolean entryExists(LdapName dn) { return osUserDn.equals(dn); } @Override - public LdapEntry daoGetEntry(LdapName key) throws NameNotFoundException { + public boolean checkConnection() { + return true; + } + + @Override + public LdapEntry doGetEntry(LdapName key) throws NameNotFoundException { if (osUserDn.equals(key)) return osUser; else @@ -86,14 +90,22 @@ public class OsUserDirectory extends AbstractLdapDirectoryDao { @Override public void init() { // TODO Auto-generated method stub - + } @Override public void destroy() { // TODO Auto-generated method stub - + + } + + @Override + public Attributes doGetAttributes(LdapName name) { + try { + return doGetEntry(name).getAttributes(); + } catch (NameNotFoundException e) { + throw new IllegalStateException(name + " doe not exist in " + getDirectory().getBaseDn(), e); + } } - }