org.wamblee.usermgt
Interface UserAdministration

All Known Implementing Classes:
UserAdministrationImpl

public interface UserAdministration

Interface for user administration. Manages the users and groups.

Author:
Erik Brakkee

Method Summary
 void addUserToGroup(User aUser, Group aGroup)
          Adds a user to a group.
 Group createGroup(java.lang.String aName)
          Creates a new group.
 User createUser(java.lang.String aUser, java.lang.String aPassword, Group aGroup)
          Creates a new user.
 Group getGroup(java.lang.String aName)
          Gets the group for a given group name.
 int getGroupCount()
           
 java.util.Set<Group> getGroups()
          Gets all known groups.
 User getUser(java.lang.String aName)
          Gets the user for a given name.
 int getUserCount()
           
 java.util.Set<User> getUsers()
          Get the users.
 java.util.Set<User> getUsers(Group aGroup)
          Gets the users for a given group.
 void groupModified(Group aGroup)
          Must be called when the group is modified.
 void removeGroup(Group aGroup)
          Removes the group.
 void removeUser(User aUser)
          Removes the user.
 void removeUserFromGroup(User aUser, Group aGroup)
          Removes a user from a group.
 void renameGroup(Group aGroup, java.lang.String aGroupName)
          Renames a group.
 void renameUser(User aUser, java.lang.String aUserName)
          Renames a user.
 void userModified(User aUser)
          Must be called when the user is modified.
 

Method Detail

createUser

User createUser(java.lang.String aUser,
                java.lang.String aPassword,
                Group aGroup)
                throws UserMgtException
Creates a new user.

Parameters:
aUser - Username.
aPassword - Password.
aGroup - Group.
Returns:
User.
Throws:
UserMgtException - In case there is a conflict with an existing user.

createGroup

Group createGroup(java.lang.String aName)
                  throws UserMgtException
Creates a new group.

Parameters:
aName - Group name.
Returns:
Group
Throws:
UserMgtException - In case there is a conflict with an existing group.

getUserCount

int getUserCount()
Returns:
Number of users.

getGroupCount

int getGroupCount()
Returns:
Number of groups.

userModified

void userModified(User aUser)
Must be called when the user is modified.

Parameters:
aUser - User.

groupModified

void groupModified(Group aGroup)
Must be called when the group is modified.

Parameters:
aGroup - Group.

getUser

User getUser(java.lang.String aName)
Gets the user for a given name.

Parameters:
aName - User name.
Returns:
User or null if not found.

getGroup

Group getGroup(java.lang.String aName)
Gets the group for a given group name.

Parameters:
aName - Group name.
Returns:
Group or null if not found.

getUsers

java.util.Set<User> getUsers()
Get the users.

Returns:
All known users.

getUsers

java.util.Set<User> getUsers(Group aGroup)
Gets the users for a given group.

Parameters:
aGroup - Group.
Returns:
Set of users (always non-null).

getGroups

java.util.Set<Group> getGroups()
Gets all known groups.

Returns:
Groups.

renameUser

void renameUser(User aUser,
                java.lang.String aUserName)
                throws UserMgtException
Renames a user.

Parameters:
aUser - User object for which user name must be changed.
aUserName - New user name.
Throws:
UserMgtException - In case the user is not known or the new user name is already in use by another user.

renameGroup

void renameGroup(Group aGroup,
                 java.lang.String aGroupName)
                 throws UserMgtException
Renames a group.

Parameters:
aGroup - Group to rename.
aGroupName - New name for the group.
Throws:
UserMgtException - In case the new group name is already used by another group of if the existing group is unknown.

removeUser

void removeUser(User aUser)
                throws UserMgtException
Removes the user.

Parameters:
aUser - User to remove.
Throws:
UserMgtException - In case the user does not exist.

removeGroup

void removeGroup(Group aGroup)
                 throws UserMgtException
Removes the group.

Parameters:
aGroup - Group to remove.
Throws:
UserMgtException - In case there are still users that are in the given group.

addUserToGroup

void addUserToGroup(User aUser,
                    Group aGroup)
                    throws UserMgtException
Adds a user to a group.

Parameters:
aUser - User.
aGroup - Group.
Throws:
UserMgtException - In case the user or group or not known or if the user is already part of the group.

removeUserFromGroup

void removeUserFromGroup(User aUser,
                         Group aGroup)
                         throws UserMgtException
Removes a user from a group.

Parameters:
aUser - User
aGroup - Group
Throws:
UserMgtException - In case the user or group are unknown or if the user is not part of the group.


Copyright © 2010. All Rights Reserved.