Interface UserService
-
- All Superinterfaces:
CRUDService<java.lang.Long,User>
,org.springframework.security.core.userdetails.UserDetailsService
- All Known Implementing Classes:
UserServiceImpl
public interface UserService extends CRUDService<java.lang.Long,User>, org.springframework.security.core.userdetails.UserDetailsService
Customized service for accessing user objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description User
changePassword(java.lang.Long userId, java.lang.String password)
Change the password on theUser
account.java.lang.Long
countUsersForProject(Project project)
User
getUserByUsername(java.lang.String username)
Get a user from the database with the supplied username.java.util.List<User>
getUsersAvailableForProject(Project project, java.lang.String filter)
Get the list ofUser
s that are not associated with the current project.java.util.List<GenericStatModel>
getUsersCreatedGrouped(java.util.Date createdDate, StatisticTimePeriod statisticTimePeriod)
Get list ofGenericStatModel
of users created in the past n time period grouped by the format provided.java.lang.Long
getUsersCreatedInTimePeriod(java.util.Date createdDate)
Get count of users created during the time periodjava.util.Collection<Join<Project,User>>
getUsersForProject(Project project)
Get all users associated with a particular project.java.util.Collection<Join<Project,User>>
getUsersForProjectByRole(Project project, ProjectRole projectRole)
java.lang.Long
getUsersLoggedIn(java.util.Date createdDate)
Get count of users logged on during the time periodUser
loadUserByEmail(java.lang.String email)
Get a user from the database with the supplied email addressorg.springframework.security.core.userdetails.UserDetails
loadUserByUsername(java.lang.String username)
org.springframework.data.domain.Page<Join<Project,User>>
searchUsersForProject(Project project, java.lang.String search, int page, int size, org.springframework.data.domain.Sort sort)
Get a page of user accounts on a project filtered by username.ProjectUserJoin
updateEmailSubscription(User user, Project project, boolean subscribed)
-
Methods inherited from interface ca.corefacility.bioinformatics.irida.service.CRUDService
count, create, delete, exists, findAll, findRevisions, findRevisions, list, list, list, read, readMultiple, search, search, update, updateFields, updateMultiple
-
-
-
-
Method Detail
-
loadUserByUsername
org.springframework.security.core.userdetails.UserDetails loadUserByUsername(java.lang.String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException
- Specified by:
loadUserByUsername
in interfaceorg.springframework.security.core.userdetails.UserDetailsService
- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
-
getUserByUsername
User getUserByUsername(java.lang.String username) throws EntityNotFoundException
Get a user from the database with the supplied username.- Parameters:
username
- the user's username.- Returns:
- the user corresponding to the username.
- Throws:
EntityNotFoundException
- if the user cannot be found by that username
-
loadUserByEmail
User loadUserByEmail(java.lang.String email) throws EntityNotFoundException
Get a user from the database with the supplied email address- Parameters:
email
- The email address to read a user for- Returns:
- The user with the given email address
- Throws:
EntityNotFoundException
- If no user has the given email address
-
getUsersForProject
java.util.Collection<Join<Project,User>> getUsersForProject(Project project)
Get all users associated with a particular project.- Parameters:
project
- the project to get users for.- Returns:
- the users associated with the project.
-
searchUsersForProject
org.springframework.data.domain.Page<Join<Project,User>> searchUsersForProject(Project project, java.lang.String search, int page, int size, org.springframework.data.domain.Sort sort)
Get a page of user accounts on a project filtered by username.- Parameters:
project
- the project to get users forsearch
- the string to filter onpage
- the current pagesize
- the size of pagesort
- the properties to sort on- Returns:
- a page of users.
-
countUsersForProject
java.lang.Long countUsersForProject(Project project)
-
getUsersAvailableForProject
java.util.List<User> getUsersAvailableForProject(Project project, java.lang.String filter)
Get the list ofUser
s that are not associated with the current project. This is a convenience method for the front end to see what users can be added to the project.- Parameters:
project
- The project we want to list the available users forfilter
- the search string to filter usernames on.- Returns:
- A List of
User
s that are not associated with the project.
-
getUsersForProjectByRole
java.util.Collection<Join<Project,User>> getUsersForProjectByRole(Project project, ProjectRole projectRole)
- Parameters:
project
- The project to find users forprojectRole
- TheProjectRole
a user needs to have to be returned- Returns:
- A Collection of
Join<Project,User>
s that have the given role
-
updateEmailSubscription
ProjectUserJoin updateEmailSubscription(User user, Project project, boolean subscribed)
- Parameters:
user
- theUser
to subscribeproject
- theProject
to subscribe tosubscribed
- whether to subscribe or unsubscribe the user- Returns:
- the updated
ProjectUserJoin
-
changePassword
User changePassword(java.lang.Long userId, java.lang.String password)
Change the password on theUser
account. This method may be called by a fully-authenticatedUser
, or by aUser
who is NOT fully-authenticated andUser.isCredentialsNonExpired()
returnsfalse
.- Parameters:
userId
- the identifier of the account to change the password for.password
- the new password for the user account.- Returns:
- the user entity with the updated password.
-
getUsersLoggedIn
java.lang.Long getUsersLoggedIn(java.util.Date createdDate)
Get count of users logged on during the time period- Parameters:
createdDate
- the minimum date for users login- Returns:
- An
Long
count of users logged in
-
getUsersCreatedInTimePeriod
java.lang.Long getUsersCreatedInTimePeriod(java.util.Date createdDate)
Get count of users created during the time period- Parameters:
createdDate
- the minimum date for users created- Returns:
- An
Long
count of users created
-
getUsersCreatedGrouped
java.util.List<GenericStatModel> getUsersCreatedGrouped(java.util.Date createdDate, StatisticTimePeriod statisticTimePeriod)
Get list ofGenericStatModel
of users created in the past n time period grouped by the format provided.- Parameters:
createdDate
- the minimum date for users createdstatisticTimePeriod
- the enum containing format for which to group the results by- Returns:
- An
GenericStatModel
list
-
-