Improve Directory framework.
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / CmsUserManager.java
index 9af578c962ab8370b0d7ceb9dc72f4024f88eb1b..040138878603fc1f0cade62ef1cd00be7d58a471 100644 (file)
@@ -8,6 +8,7 @@ import java.util.Set;
 import javax.security.auth.Subject;
 
 import org.argeo.osgi.useradmin.UserDirectory;
+import org.argeo.util.directory.HierarchyUnit;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.useradmin.Role;
 import org.osgi.service.useradmin.User;
@@ -17,52 +18,59 @@ import org.osgi.service.useradmin.User;
  * the userAdmin.
  */
 public interface CmsUserManager {
-       public Map<String, String> getKnownBaseDns(boolean onlyWritable);
-       public Set<UserDirectory> getUserDirectories();
-       
+       Map<String, String> getKnownBaseDns(boolean onlyWritable);
+
+       Set<UserDirectory> getUserDirectories();
+
        // CurrentUser
        /** Returns the e-mail of the current logged in user */
-       public String getMyMail();
+       String getMyMail();
 
        // Other users
        /** Returns a {@link User} given a username */
-       public User getUser(String username);
+       User getUser(String username);
 
        /** Can be a group or a user */
-       public String getUserDisplayName(String dn);
+       String getUserDisplayName(String dn);
 
        /** Can be a group or a user */
-       public String getUserMail(String dn);
+       String getUserMail(String dn);
 
        /** Lists all roles of the given user */
-       public String[] getUserRoles(String dn);
+       String[] getUserRoles(String dn);
 
        /** Checks if the passed user belongs to the passed role */
-       public boolean isUserInRole(String userDn, String roleDn);
+       boolean isUserInRole(String userDn, String roleDn);
 
        // Search
        /** Returns a filtered list of roles */
-       public Role[] getRoles(String filter) throws InvalidSyntaxException;
+       Role[] getRoles(String filter) throws InvalidSyntaxException;
 
        /** Recursively lists users in a given group. */
-       public Set<User> listUsersInGroup(String groupDn, String filter);
+       Set<User> listUsersInGroup(String groupDn, String filter);
 
        /** Search among groups including system roles and users if needed */
-       public List<User> listGroups(String filter, boolean includeUsers, boolean includeSystemRoles);
+       List<User> listGroups(String filter, boolean includeUsers, boolean includeSystemRoles);
+
+       /*
+        * EDITION
+        */
+       /** Creates a new user.*/
+       User createUser(String username, Map<String, Object> properties, Map<String, Object> credentials);
 
        /* MISCELLANEOUS */
        /** Returns the dn of a role given its local ID */
-       public String buildDefaultDN(String localId, int type);
+       String buildDefaultDN(String localId, int type);
 
        /** Exposes the main default domain name for this instance */
-       public String getDefaultDomainName();
+       String getDefaultDomainName();
 
        /**
         * Search for a {@link User} (might also be a group) whose uid or cn is equals
         * to localId within the various user repositories defined in the current
         * context.
         */
-       public User getUserFromLocalId(String localId);
+       User getUserFromLocalId(String localId);
 
        void changeOwnPassword(char[] oldPassword, char[] newPassword);
 
@@ -80,14 +88,9 @@ public interface CmsUserManager {
        void expireAuthToken(String token);
 
        void expireAuthTokens(Subject subject);
-       
-       UserDirectory getDirectory(Role role);
 
-//     User createUserFromPerson(Node person);
+       UserDirectory getDirectory(Role role);
 
-//     @Deprecated
-//     public UserAdmin getUserAdmin();
-//
-//     @Deprecated
-//     public UserTransaction getUserTransaction();
+       /** Create a new hierarchy unit. Does nothing if it already exists. */
+       HierarchyUnit createHierarchyUnit(UserDirectory directory, String path);
 }
\ No newline at end of file