X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FDirectoryUserAdmin.java;h=6f12195dc3c1d6ea6c52b1b056b0fecafe512b0a;hb=0ce8ecfe974cec9f524c16884209cd08544d890d;hp=9f6d62d7a64600e85224c717786c0379335868fe;hpb=df60fd8de17590b8f4ab32fd0278e57aaaedbfa2;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/osgi/useradmin/DirectoryUserAdmin.java b/org.argeo.util/src/org/argeo/osgi/useradmin/DirectoryUserAdmin.java index 9f6d62d7a..6f12195dc 100644 --- a/org.argeo.util/src/org/argeo/osgi/useradmin/DirectoryUserAdmin.java +++ b/org.argeo.util/src/org/argeo/osgi/useradmin/DirectoryUserAdmin.java @@ -30,7 +30,6 @@ import org.argeo.util.directory.ldap.LdapEntry; import org.argeo.util.directory.ldap.LdapEntryWorkingCopy; import org.argeo.util.directory.ldap.LdapNameUtils; import org.argeo.util.directory.ldap.LdifDao; -import org.argeo.util.naming.LdapObjs; import org.osgi.framework.Filter; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; @@ -74,7 +73,7 @@ public class DirectoryUserAdmin extends AbstractLdapDirectory implements UserAdm String username = (String) credentials.get(SHARED_STATE_USERNAME); if (username == null) username = user.getName(); - Dictionary properties = cloneProperties(); + Dictionary properties = cloneConfigProperties(); properties.put(Context.SECURITY_PRINCIPAL, username.toString()); Object pwdCred = credentials.get(SHARED_STATE_PASSWORD); byte[] pwd = (byte[]) pwdCred; @@ -102,7 +101,7 @@ public class DirectoryUserAdmin extends AbstractLdapDirectory implements UserAdm } else { throw new IllegalStateException("Password is required"); } - Dictionary properties = cloneProperties(); + Dictionary properties = cloneConfigProperties(); properties.put(DirectoryConf.readOnly.name(), "true"); DirectoryUserAdmin scopedUserAdmin = new DirectoryUserAdmin(null, properties, true); // scopedUserAdmin.groups = Collections.unmodifiableNavigableMap(groups); @@ -283,7 +282,7 @@ public class DirectoryUserAdmin extends AbstractLdapDirectory implements UserAdm checkEdit(); LdapEntryWorkingCopy wc = getWorkingCopy(); LdapName dn = toLdapName(name); - if ((getDirectoryDao().daoHasEntry(dn) && !wc.getDeletedData().containsKey(dn)) + if ((getDirectoryDao().entryExists(dn) && !wc.getDeletedData().containsKey(dn)) || wc.getNewData().containsKey(dn)) throw new IllegalArgumentException("Already a role " + name); BasicAttributes attrs = new BasicAttributes(true); @@ -380,17 +379,11 @@ public class DirectoryUserAdmin extends AbstractLdapDirectory implements UserAdm */ protected LdapEntry newUser(LdapName name, Attributes attrs) { // TODO support devices, applications, etc. - return new LdifUser.LdifPerson(this, name, attrs); + return new LdifUser(this, name, attrs); } protected LdapEntry newGroup(LdapName name, Attributes attrs) { - if (LdapNameUtils.getParentRdn(name).equals(getSystemRoleBaseRdn())) - return new LdifGroup.LdifSystemPermissions(this, name, attrs); - - if (hasObjectClass(attrs, LdapObjs.organization)) - return new LdifGroup.LdifOrganization(this, name, attrs); - else - return new LdifGroup.LdifFunctionalGroup(this, name, attrs); + return new LdifGroup(this, name, attrs); }