Documentation
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / auth / CmsUserManagerImpl.java
index 0bf9a211bd35ff5bc31de09f7e165cd0d34ed9e5..a8a322356f45a52893a25af3c3c6c02be107d7d9 100644 (file)
@@ -94,7 +94,7 @@ public class CmsUserManagerImpl implements CmsUserManager {
 
        // ALL USER: WARNING access to this will be later reduced
 
-       /** Retrieve a user given his dn */
+       /** Retrieve a user given his dn, or <code>null</code> if it doesn't exist. */
        public User getUser(String dn) {
                return (User) getUserAdmin().getRole(dn);
        }
@@ -140,6 +140,22 @@ public class CmsUserManagerImpl implements CmsUserManager {
                return users;
        }
 
+//     @Override
+//     public Set<User> listAccounts(HierarchyUnit hierarchyUnit, boolean deep) {
+//             if(!hierarchyUnit.isFunctional())
+//                     throw new IllegalArgumentException("Hierarchy unit "+hierarchyUnit.getBase()+" is not functional");
+//             UserDirectory directory = (UserDirectory)hierarchyUnit.getDirectory();
+//             Set<User> res = new HashSet<>();
+//             for(HierarchyUnit technicalHu:hierarchyUnit.getDirectHierarchyUnits(false)) {
+//                     if(technicalHu.isFunctional())
+//                             continue;
+//                     for(Role role:directory.getHierarchyUnitRoles(technicalHu, null, false)) {
+//                             if(role)
+//                     }
+//             }
+//             return res;
+//     }
+
        /** Recursively add users to list */
        private void addUsers(Set<User> users, Group group, String filter) {
                Role[] roles = group.getMembers();
@@ -166,7 +182,8 @@ public class CmsUserManagerImpl implements CmsUserManager {
                List<User> users = new ArrayList<User>();
                for (Role role : roles) {
                        if ((includeUsers && role.getType() == Role.USER || role.getType() == Role.GROUP) && !users.contains(role)
-                                       && (includeSystemRoles || !role.getName().toLowerCase().endsWith(CmsConstants.ROLES_BASEDN))) {
+                                       && (includeSystemRoles
+                                                       || !role.getName().toLowerCase().endsWith(CmsConstants.SYSTEM_ROLES_BASEDN))) {
                                if (match(role, filter))
                                        users.add((User) role);
                        }
@@ -368,7 +385,7 @@ public class CmsUserManagerImpl implements CmsUserManager {
 
                        if (onlyWritable && readOnly)
                                continue;
-                       if (baseDn.equalsIgnoreCase(CmsConstants.ROLES_BASEDN))
+                       if (baseDn.equalsIgnoreCase(CmsConstants.SYSTEM_ROLES_BASEDN))
                                continue;
                        if (baseDn.equalsIgnoreCase(CmsConstants.TOKENS_BASEDN))
                                continue;