Class UserManagementServiceImpl
- java.lang.Object
-
- org.onebusaway.admin.service.impl.UserManagementServiceImpl
-
- All Implemented Interfaces:
UserManagementService
@Component public class UserManagementServiceImpl extends Object implements UserManagementService
Default implementation ofUserManagementService
- Author:
- abelsare
-
-
Constructor Summary
Constructors Constructor Description UserManagementServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
activateUser(UserDetail userDetail)
Activates a given user that has been deactivatedboolean
createUser(String userName, String password, boolean admin)
Creates a user in the system with given user name and password.boolean
createUser(String userName, String password, String role)
Creates a user in the system with given user name and password.boolean
deactivateUser(UserDetail userDetail)
Deactivates/soft deletes a given user.void
disableOperatorRole(User user)
Disables operator role for the given user.List<UserDetail>
getActiveUsersDetails()
Returns a list of user details (name, role) for every enabled user in the database An enabled user is a user where the property isDisabled=falseList<String>
getAllRoleNames()
List<UserDetail>
getInactiveUsersDetails()
Returns a list of user details (name, role) for every disabled user in the database An disabled user is a user where the property isDisabled=trueList<String>
getManagedRoleNames()
UserDetail
getUserDetail(String userName)
Fetches the user details such as user name, user role of the given userList<UserDetail>
getUserDetails(int start, int maxResults)
Returns a list of user details (name, role) for maxResults of users staring with 'start'Integer
getUserDetailsCount()
Returns the number of user details (name, role) for every user in the databaseList<String>
getUserNames(String searchString)
Returns a list of user names that contain the given search stringboolean
inactivateUser(UserDetail userDetail)
Inactivates a given user.void
setAuthoritiesService(StandardAuthoritiesService authoritiesService)
void
setPasswordEncoder(VersionedPasswordEncoder passwordEncoder)
void
setSesssionFactory(org.hibernate.SessionFactory sessionFactory)
void
setUserDao(UserDao userDao)
void
setUserPropertiesService(UserPropertiesService userPropertiesService)
InjectsUserPropertiesService
void
setUserService(UserService userService)
InjectsUserService
boolean
updateUser(UserDetail userDetail)
Updates user in the system with new password and role.
-
-
-
Method Detail
-
getUserNames
@Transactional(readOnly=true) public List<String> getUserNames(String searchString)
Description copied from interface:UserManagementService
Returns a list of user names that contain the given search string- Specified by:
getUserNames
in interfaceUserManagementService
- Returns:
- list of matching user names that contains the given search string
-
getUserDetailsCount
@Transactional(readOnly=true) public Integer getUserDetailsCount()
Description copied from interface:UserManagementService
Returns the number of user details (name, role) for every user in the database- Specified by:
getUserDetailsCount
in interfaceUserManagementService
- Returns:
- long number (count) of user details
-
getUserDetails
@Transactional(readOnly=true) public List<UserDetail> getUserDetails(int start, int maxResults)
Description copied from interface:UserManagementService
Returns a list of user details (name, role) for maxResults of users staring with 'start'- Specified by:
getUserDetails
in interfaceUserManagementService
- Returns:
- list of userDetails
-
getActiveUsersDetails
@Transactional(readOnly=true) public List<UserDetail> getActiveUsersDetails()
Description copied from interface:UserManagementService
Returns a list of user details (name, role) for every enabled user in the database An enabled user is a user where the property isDisabled=false- Specified by:
getActiveUsersDetails
in interfaceUserManagementService
- Returns:
- list of userDetails
-
getInactiveUsersDetails
@Transactional(readOnly=true) public List<UserDetail> getInactiveUsersDetails()
Description copied from interface:UserManagementService
Returns a list of user details (name, role) for every disabled user in the database An disabled user is a user where the property isDisabled=true- Specified by:
getInactiveUsersDetails
in interfaceUserManagementService
- Returns:
- list of userDetails
-
getUserDetail
@Transactional(readOnly=true) public UserDetail getUserDetail(String userName)
Description copied from interface:UserManagementService
Fetches the user details such as user name, user role of the given user- Specified by:
getUserDetail
in interfaceUserManagementService
- Parameters:
userName
- user whose details are desired- Returns:
- user details of the desired user
-
disableOperatorRole
@Transactional public void disableOperatorRole(User user)
Description copied from interface:UserManagementService
Disables operator role for the given user. A user can either be an admin or operator but not both.- Specified by:
disableOperatorRole
in interfaceUserManagementService
- Parameters:
user
- system user
-
createUser
@Transactional public boolean createUser(String userName, String password, boolean admin)
Description copied from interface:UserManagementService
Creates a user in the system with given user name and password. Assigns admin role to the created user if admin flag is set- Specified by:
createUser
in interfaceUserManagementService
- Parameters:
userName
- user name of the new userpassword
- password of the new useradmin
- true if user beign created is admin- Returns:
- true if user creation is successful, false otherwise
-
createUser
public boolean createUser(String userName, String password, String role)
Description copied from interface:UserManagementService
Creates a user in the system with given user name and password. Assigns admin role to the created user if admin flag is set- Specified by:
createUser
in interfaceUserManagementService
- Parameters:
userName
- user name of the new userpassword
- password of the new userrole
- role of the new user- Returns:
- true if user creation is successful, false otherwise
-
updateUser
@Transactional public boolean updateUser(UserDetail userDetail)
Description copied from interface:UserManagementService
Updates user in the system with new password and role. Only updates the user record if it is found in the system.- Specified by:
updateUser
in interfaceUserManagementService
- Parameters:
userDetail
- userDetails such as username, password etc- Returns:
- true if update operation succeeds, false otherwise
-
inactivateUser
@Transactional public boolean inactivateUser(UserDetail userDetail)
Description copied from interface:UserManagementService
Inactivates a given user. User can be activated again.- Specified by:
inactivateUser
in interfaceUserManagementService
- Parameters:
userDetail
- userDetails such as id, username etc- Returns:
- true if setting isDisabled property succeeds, false otherwise
-
activateUser
@Transactional public boolean activateUser(UserDetail userDetail)
Description copied from interface:UserManagementService
Activates a given user that has been deactivated- Specified by:
activateUser
in interfaceUserManagementService
- Parameters:
userDetail
- userDetails such as id, username etc- Returns:
- true if setting isDisabled property succeeds, false otherwise
-
deactivateUser
@Transactional public boolean deactivateUser(UserDetail userDetail)
Description copied from interface:UserManagementService
Deactivates/soft deletes a given user. This action is un-reversible. Called "delete" in the UI- Specified by:
deactivateUser
in interfaceUserManagementService
- Parameters:
userDetail
- userDetails such as id, username etc- Returns:
- true if soft delete operation succeeds, false otherwise
-
setSesssionFactory
@Autowired public void setSesssionFactory(org.hibernate.SessionFactory sessionFactory)
-
setAuthoritiesService
@Autowired public void setAuthoritiesService(StandardAuthoritiesService authoritiesService)
- Parameters:
authoritiesService
- the authoritiesService to set
-
setUserDao
@Autowired public void setUserDao(UserDao userDao)
- Parameters:
userDao
- the userDao to set
-
setUserService
@Autowired public void setUserService(UserService userService)
InjectsUserService
- Parameters:
userService
- the userService to set
-
setPasswordEncoder
@Autowired public void setPasswordEncoder(VersionedPasswordEncoder passwordEncoder)
- Parameters:
passwordEncoder
- the passwordEncoder to set
-
getAllRoleNames
public List<String> getAllRoleNames()
- Specified by:
getAllRoleNames
in interfaceUserManagementService
-
getManagedRoleNames
public List<String> getManagedRoleNames()
- Specified by:
getManagedRoleNames
in interfaceUserManagementService
-
setUserPropertiesService
@Autowired public void setUserPropertiesService(UserPropertiesService userPropertiesService)
InjectsUserPropertiesService
- Parameters:
userPropertiesService
- the userPropertiesService to set
-
-