it.eng.rdlab.soa3.um.rest.impl
Class UserManagerImpl

java.lang.Object
  extended by it.eng.rdlab.soa3.um.rest.impl.UserManagerImpl
All Implemented Interfaces:
IUserManagementService.UserManager

public class UserManagerImpl
extends Object
implements IUserManagementService.UserManager

This class is a layer between the RESTFul WS and the LDAPUserManagement for operations on users

Version:
1.0
Author:
Ermanno Travaglino

Field Summary
 
Fields inherited from interface it.eng.rdlab.soa3.um.rest.IUserManagementService.UserManager
CHANGE_PASSWORD_EQUAL_PASSWORDS, CHANGE_PASSWORD_GENERIC_ERROR, CHANGE_PASSWORD_INVALID_NEW_PASSWORD, CHANGE_PASSWORD_OK, CHANGE_PASSWORD_USER_NOT_FOUND, CHANGE_PASSWORD_WRONG_USER_PASSWORD
 
Constructor Summary
UserManagerImpl(String ldapUrl)
           
 
Method Summary
 boolean addUserToGroup(String userId, String groupId, String organizationName, String adminUserId, String password)
          Adds an user, by userId, to a group, by groupName (and organizationName)
 boolean assignRoleToUser(String roleName, String userId, String organizationName, String adminUserId, String password)
          Assigns a role, by roleName, to an user, by userId (and organizationName)
 int changePassword(String userId, String oldPassword, String newPassword, String organizationName, String adminUserId, String password)
          Changes user's password by userId and old/newPassword (and organizationName)
 String createUser(UserModel userModel, String organizationName, String adminUserId, String password)
          Creates a new user by UserModel (and organizationName)
 boolean deleteUser(String userId, String organizationName, String adminUserId, String password)
          Deletes an user by userId (and organizationName)
 boolean deleteUsers(String organizationName, String adminUserId, String password)
          Deletes all users under an organization by organizationId
 boolean dismissRoleToUser(String roleName, String userId, String organizationName, String adminUserId, String password)
          Dismisses a role, by roleName, to an user, by userId (and organizationName)
 UserModel getUser(String userId, String organizationName, String adminUserId, String password)
          Gets user by userId (and organizationName)
 HashMap<UserModel,List<GroupModel>> listAllUsersAndGroups(String organizationName, String adminUserId, String password)
          Lists all users with the associated groups (by organizationName)
 HashMap<UserModel,List<RoleModel>> listAllUsersAndRoles(String organizationName, String adminUserId, String password)
          Lists all users with the associated roles (by organizationName)
 List<UserModel> listUsers(String adminUserId, String password)
          Lists all present users
 List<UserModel> listUsersByAttribute(Map<String,String> attributes, String adminUserId, String adminPassword)
          Lists all the users with the attributes send as parameters
 List<UserModel> listUsersByGroup(String groupName, String organizationName, String adminUserId, String password)
          Lists all users with the groupName group
 List<UserModel> listUsersByOrganization(String organizationName, String adminUserId, String password)
          Lists all users under an organization by organizationName
 List<UserModel> listUsersByOrganizationAndAttributes(String organizationName, Map<String,String> attributes, String adminUserId, String adminPassword)
          Lists all users under an organization by organizationName
 List<UserModel> listUsersByRole(String roleName, String organizationName, String adminUserId, String password)
          Lists all users with the roleName role
 boolean removeUserFromGroup(String userId, String groupId, String organizationName, String adminUserId, String password)
          Removes an user, by userId, from a group, by groupName (and organizationName)
 boolean updateUser(UserModel user, String organizationName, String adminUserId, String password)
          Updates user's attributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserManagerImpl

public UserManagerImpl(String ldapUrl)
Method Detail

assignRoleToUser

public boolean assignRoleToUser(String roleName,
                                String userId,
                                String organizationName,
                                String adminUserId,
                                String password)
Description copied from interface: IUserManagementService.UserManager
Assigns a role, by roleName, to an user, by userId (and organizationName)

Specified by:
assignRoleToUser in interface IUserManagementService.UserManager
Returns:
true if the user's role has been assigned as a result of the call

createUser

public String createUser(UserModel userModel,
                         String organizationName,
                         String adminUserId,
                         String password)
Description copied from interface: IUserManagementService.UserManager
Creates a new user by UserModel (and organizationName)

Specified by:
createUser in interface IUserManagementService.UserManager
Returns:
user creation process response String

deleteUser

public boolean deleteUser(String userId,
                          String organizationName,
                          String adminUserId,
                          String password)
Description copied from interface: IUserManagementService.UserManager
Deletes an user by userId (and organizationName)

Specified by:
deleteUser in interface IUserManagementService.UserManager
Returns:
true if the user was removed as a result of this call

listAllUsersAndRoles

public HashMap<UserModel,List<RoleModel>> listAllUsersAndRoles(String organizationName,
                                                               String adminUserId,
                                                               String password)
Description copied from interface: IUserManagementService.UserManager
Lists all users with the associated roles (by organizationName)

Specified by:
listAllUsersAndRoles in interface IUserManagementService.UserManager
Returns:
an HashMap containing all users and associated roles as a result of the call

listUsers

public List<UserModel> listUsers(String adminUserId,
                                 String password)
Description copied from interface: IUserManagementService.UserManager
Lists all present users

Specified by:
listUsers in interface IUserManagementService.UserManager
Returns:
a List containing all users

listUsersByRole

public List<UserModel> listUsersByRole(String roleName,
                                       String organizationName,
                                       String adminUserId,
                                       String password)
Description copied from interface: IUserManagementService.UserManager
Lists all users with the roleName role

Specified by:
listUsersByRole in interface IUserManagementService.UserManager
Returns:
a List containing all users by role as a result of the call

listUsersByOrganization

public List<UserModel> listUsersByOrganization(String organizationName,
                                               String adminUserId,
                                               String password)
Description copied from interface: IUserManagementService.UserManager
Lists all users under an organization by organizationName

Specified by:
listUsersByOrganization in interface IUserManagementService.UserManager
Returns:
a List containing all users by organization as a result of the call

updateUser

public boolean updateUser(UserModel user,
                          String organizationName,
                          String adminUserId,
                          String password)
Description copied from interface: IUserManagementService.UserManager
Updates user's attributes

Specified by:
updateUser in interface IUserManagementService.UserManager
Returns:
true if this user updated as a result of the call

changePassword

public int changePassword(String userId,
                          String oldPassword,
                          String newPassword,
                          String organizationName,
                          String adminUserId,
                          String password)
Description copied from interface: IUserManagementService.UserManager
Changes user's password by userId and old/newPassword (and organizationName)

Specified by:
changePassword in interface IUserManagementService.UserManager
Returns:
status code as a result of this call

deleteUsers

public boolean deleteUsers(String organizationName,
                           String adminUserId,
                           String password)
Description copied from interface: IUserManagementService.UserManager
Deletes all users under an organization by organizationId

Specified by:
deleteUsers in interface IUserManagementService.UserManager
Returns:
true if the users have been removed as a result of this call

getUser

public UserModel getUser(String userId,
                         String organizationName,
                         String adminUserId,
                         String password)
Description copied from interface: IUserManagementService.UserManager
Gets user by userId (and organizationName)

Specified by:
getUser in interface IUserManagementService.UserManager
Returns:
object with specified name UserModel

dismissRoleToUser

public boolean dismissRoleToUser(String roleName,
                                 String userId,
                                 String organizationName,
                                 String adminUserId,
                                 String password)
Description copied from interface: IUserManagementService.UserManager
Dismisses a role, by roleName, to an user, by userId (and organizationName)

Specified by:
dismissRoleToUser in interface IUserManagementService.UserManager
Returns:
true if the user's role has been dismissed as a result of the call

addUserToGroup

public boolean addUserToGroup(String userId,
                              String groupId,
                              String organizationName,
                              String adminUserId,
                              String password)
Description copied from interface: IUserManagementService.UserManager
Adds an user, by userId, to a group, by groupName (and organizationName)

Specified by:
addUserToGroup in interface IUserManagementService.UserManager
Returns:
true if the user has been added to group as a result of the call

removeUserFromGroup

public boolean removeUserFromGroup(String userId,
                                   String groupId,
                                   String organizationName,
                                   String adminUserId,
                                   String password)
Description copied from interface: IUserManagementService.UserManager
Removes an user, by userId, from a group, by groupName (and organizationName)

Specified by:
removeUserFromGroup in interface IUserManagementService.UserManager
Returns:
true if the user has been removed from group as a result of the call

listUsersByGroup

public List<UserModel> listUsersByGroup(String groupName,
                                        String organizationName,
                                        String adminUserId,
                                        String password)
Description copied from interface: IUserManagementService.UserManager
Lists all users with the groupName group

Specified by:
listUsersByGroup in interface IUserManagementService.UserManager
Returns:
a List containing all users by group as a result of the call

listAllUsersAndGroups

public HashMap<UserModel,List<GroupModel>> listAllUsersAndGroups(String organizationName,
                                                                 String adminUserId,
                                                                 String password)
Description copied from interface: IUserManagementService.UserManager
Lists all users with the associated groups (by organizationName)

Specified by:
listAllUsersAndGroups in interface IUserManagementService.UserManager
Returns:
an HashMap containing all users and associated groups as a result of the call

listUsersByOrganizationAndAttributes

public List<UserModel> listUsersByOrganizationAndAttributes(String organizationName,
                                                            Map<String,String> attributes,
                                                            String adminUserId,
                                                            String adminPassword)
Description copied from interface: IUserManagementService.UserManager
Lists all users under an organization by organizationName

Specified by:
listUsersByOrganizationAndAttributes in interface IUserManagementService.UserManager
attributes - key-value couple of the attributes
Returns:
a List containing all users by organization as a result of the call

listUsersByAttribute

public List<UserModel> listUsersByAttribute(Map<String,String> attributes,
                                            String adminUserId,
                                            String adminPassword)
Description copied from interface: IUserManagementService.UserManager
Lists all the users with the attributes send as parameters

Specified by:
listUsersByAttribute in interface IUserManagementService.UserManager
Parameters:
attributes - key-value couple of the attributes
Returns:
a List containing all users


Copyright © 2013. All Rights Reserved.