]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.cms/src/org/argeo/cms/internal/auth/CmsUserManagerImpl.java
Improve naming. Fix Argeo namespace base.
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / auth / CmsUserManagerImpl.java
index 5d5477e9b953d567cea8d831af3dcf86dbc48494..6e2c6c435df469d5256ab27f4b3472710e2187e7 100644 (file)
@@ -31,13 +31,13 @@ import org.argeo.api.cms.CmsLog;
 import org.argeo.cms.CmsUserManager;
 import org.argeo.cms.auth.CurrentUser;
 import org.argeo.cms.auth.UserAdminUtils;
-import org.argeo.osgi.transaction.WorkTransaction;
 import org.argeo.osgi.useradmin.TokenUtils;
-import org.argeo.osgi.useradmin.UserAdminConf;
 import org.argeo.osgi.useradmin.UserDirectory;
+import org.argeo.util.directory.DirectoryConf;
+import org.argeo.util.directory.ldap.SharedSecret;
 import org.argeo.util.naming.LdapAttrs;
 import org.argeo.util.naming.NamingUtils;
-import org.argeo.util.naming.SharedSecret;
+import org.argeo.util.transaction.WorkTransaction;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.useradmin.Authorization;
 import org.osgi.service.useradmin.Group;
@@ -232,7 +232,7 @@ public class CmsUserManagerImpl implements CmsUserManager {
                Map<String, String> dns = new HashMap<String, String>();
                for (UserDirectory userDirectory : userDirectories.keySet()) {
                        Boolean readOnly = userDirectory.isReadOnly();
-                       String baseDn = userDirectory.getGlobalId();
+                       String baseDn = userDirectory.getContext();
 
                        if (onlyWritable && readOnly)
                                continue;
@@ -240,26 +240,26 @@ public class CmsUserManagerImpl implements CmsUserManager {
                                continue;
                        if (baseDn.equalsIgnoreCase(CmsConstants.TOKENS_BASEDN))
                                continue;
-                       dns.put(baseDn, UserAdminConf.propertiesAsUri(userDirectories.get(userDirectory)).toString());
+                       dns.put(baseDn, DirectoryConf.propertiesAsUri(userDirectories.get(userDirectory)).toString());
 
                }
                return dns;
        }
 
        public Set<UserDirectory> getUserDirectories() {
-               TreeSet<UserDirectory> res = new TreeSet<>((o1, o2) -> o1.getGlobalId().compareTo(o2.getGlobalId()));
+               TreeSet<UserDirectory> res = new TreeSet<>((o1, o2) -> o1.getContext().compareTo(o2.getContext()));
                res.addAll(userDirectories.keySet());
                return res;
        }
 
        public String buildDistinguishedName(String localId, String baseDn, int type) {
                Map<String, String> dns = getKnownBaseDns(true);
-               Dictionary<String, ?> props = UserAdminConf.uriAsProperties(dns.get(baseDn));
+               Dictionary<String, ?> props = DirectoryConf.uriAsProperties(dns.get(baseDn));
                String dn = null;
                if (Role.GROUP == type)
-                       dn = LdapAttrs.cn.name() + "=" + localId + "," + UserAdminConf.groupBase.getValue(props) + "," + baseDn;
+                       dn = LdapAttrs.cn.name() + "=" + localId + "," + DirectoryConf.groupBase.getValue(props) + "," + baseDn;
                else if (Role.USER == type)
-                       dn = LdapAttrs.uid.name() + "=" + localId + "," + UserAdminConf.userBase.getValue(props) + "," + baseDn;
+                       dn = LdapAttrs.uid.name() + "=" + localId + "," + DirectoryConf.userBase.getValue(props) + "," + baseDn;
                else
                        throw new IllegalStateException("Unknown role type. " + "Cannot deduce dn for " + localId);
                return dn;
@@ -445,8 +445,8 @@ public class CmsUserManagerImpl implements CmsUserManager {
                String name = user.getName();
                NavigableMap<String, UserDirectory> possible = new TreeMap<>();
                for (UserDirectory userDirectory : userDirectories.keySet()) {
-                       if (name.endsWith(userDirectory.getGlobalId())) {
-                               possible.put(userDirectory.getGlobalId(), userDirectory);
+                       if (name.endsWith(userDirectory.getContext())) {
+                               possible.put(userDirectory.getContext(), userDirectory);
                        }
                }
                if (possible.size() == 0)