org.wamblee.security.authentication
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(java.lang.String aUser, java.lang.String aGroup)
          Adds a user to a group.
 boolean changePassword(java.lang.String aUser, java.lang.String aOldPassword, java.lang.String aNewPassword)
          Changes the password.
 boolean checkGroup(java.lang.String aGroup)
          Check if a group exists.
 boolean checkPassword(java.lang.String aUser, java.lang.String aPassword)
          Checks the password.
 boolean checkUser(java.lang.String aUser)
          Checks if a user exists.
 void createGroup(java.lang.String aName)
          Creates a new group.
 void createUser(java.lang.String aUser, java.lang.String aPassword)
          Creates a new user.
 int getGroupCount()
           
 java.util.List<java.lang.String> getGroups()
          Gets all groups.
 java.util.List<java.lang.String> getGroups(java.lang.String aUser)
          Gets all groups for a given user.
 int getUserCount()
           
 java.util.List<java.lang.String> getUsers()
          Get the users.
 java.util.List<java.lang.String> getUsers(java.lang.String aGroup)
          Gets the users for a given group.
 boolean isInGroup(java.lang.String aUser, java.lang.String aGroup)
          Checks if the user belongs to the given group.
 void removeGroup(java.lang.String aGroup)
          Removes the group.
 void removeUser(java.lang.String aUser)
          Removes the user.
 void removeUserFromGroup(java.lang.String aUser, java.lang.String aGroup)
          Removes a user from a group.
 void renameGroup(java.lang.String aOldGroup, java.lang.String aGroupName)
          Renames a group.
 void renameUser(java.lang.String aOldUserName, java.lang.String aUserName)
          Renames a user.
 void setPassword(java.lang.String aUser, java.lang.String aPassword)
           
 

Method Detail

createUser

void createUser(java.lang.String aUser,
                java.lang.String aPassword)
Creates a new user.

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

createGroup

void createGroup(java.lang.String aName)
Creates a new group.

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

checkUser

boolean checkUser(java.lang.String aUser)
Checks if a user exists.

Parameters:
aUser - User to check.
Returns:
True iff user exists.

checkGroup

boolean checkGroup(java.lang.String aGroup)
Check if a group exists.

Parameters:
aGroup - Group.
Returns:
True iff group exists.

checkPassword

boolean checkPassword(java.lang.String aUser,
                      java.lang.String aPassword)
Checks the password.

Parameters:
aUser - User to check password for.
aPassword - Password to check.
Returns:
True iff password is ok.
Throws:
UserMgtException - In case user does not exist.

changePassword

boolean changePassword(java.lang.String aUser,
                       java.lang.String aOldPassword,
                       java.lang.String aNewPassword)
Changes the password.

Parameters:
aUser - User.
aOldPassword - Old password.
aNewPassword - New password.
Returns:
True if the password was changed.
Throws:
UserMgtException - Inc ase the user does not exist.

setPassword

void setPassword(java.lang.String aUser,
                 java.lang.String aPassword)
Parameters:
aUser - User.
aPassword - The password to set.
Throws:
UserMgtException - Inc ase the user does not exist.

isInGroup

boolean isInGroup(java.lang.String aUser,
                  java.lang.String aGroup)
Checks if the user belongs to the given group.

Parameters:
aUser - User
aGroup - Group.
Returns:
True iff user is in group
Throws:
UserMgtException - In case the user or group do not exist.

getUserCount

int getUserCount()
Returns:
Number of users.

getGroupCount

int getGroupCount()
Returns:
Number of groups.

getUsers

java.util.List<java.lang.String> getUsers()
Get the users.

Returns:
All known users.

getUsers

java.util.List<java.lang.String> getUsers(java.lang.String aGroup)
Gets the users for a given group.

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

getGroups

java.util.List<java.lang.String> getGroups()
Gets all groups.

Returns:
Groups.

getGroups

java.util.List<java.lang.String> getGroups(java.lang.String aUser)
Gets all groups for a given user.

Parameters:
aUser - user.
Returns:
Groups.

renameUser

void renameUser(java.lang.String aOldUserName,
                java.lang.String aUserName)
Renames a user.

Parameters:
aOldUserName - Current user name.
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(java.lang.String aOldGroup,
                 java.lang.String aGroupName)
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(java.lang.String aUser)
Removes the user.

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

removeGroup

void removeGroup(java.lang.String aGroup)
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(java.lang.String aUser,
                    java.lang.String aGroup)
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(java.lang.String aUser,
                         java.lang.String aGroup)
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 © 2022. All Rights Reserved.