Package org.powertac.visualizer.service
Class UserService
- java.lang.Object
-
- org.powertac.visualizer.service.UserService
-
@Service @Transactional public class UserService extends Object
Service class for managing users.
-
-
Constructor Summary
Constructors Constructor Description UserService(UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, PersistentTokenRepository persistentTokenRepository, AuthorityRepository authorityRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangePassword(String password)UsercreateUser(String login, String password, String firstName, String lastName, String langKey)UsercreateUser(UserDTO userDTO)voiddeleteUser(String login)org.springframework.data.domain.Page<UserDTO>getAllManagedUsers(org.springframework.data.domain.Pageable pageable)Optional<User>getUserByLogin(String login)UsergetUserWithAuthorities()UsergetUserWithAuthorities(Long id)Optional<User>getUserWithAuthoritiesByLogin(String login)voidremoveOldPersistentTokens()Persistent Token are used for providing automatic authentication, they should be automatically deleted after 30 days.voidupdateUser(String firstName, String lastName, String langKey)Update basic information (first name, last name, language) for the current user.Optional<UserDTO>updateUser(UserDTO userDTO)Update all information for a specific user, and return the modified user.
-
-
-
Constructor Detail
-
UserService
public UserService(UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, PersistentTokenRepository persistentTokenRepository, AuthorityRepository authorityRepository)
-
-
Method Detail
-
createUser
public User createUser(String login, String password, String firstName, String lastName, String langKey)
-
updateUser
public void updateUser(String firstName, String lastName, String langKey)
Update basic information (first name, last name, language) for the current user.
-
updateUser
public Optional<UserDTO> updateUser(UserDTO userDTO)
Update all information for a specific user, and return the modified user.
-
deleteUser
public void deleteUser(String login)
-
changePassword
public void changePassword(String password)
-
getAllManagedUsers
@Transactional(readOnly=true) public org.springframework.data.domain.Page<UserDTO> getAllManagedUsers(org.springframework.data.domain.Pageable pageable)
-
getUserWithAuthoritiesByLogin
@Transactional(readOnly=true) public Optional<User> getUserWithAuthoritiesByLogin(String login)
-
getUserWithAuthorities
@Transactional(readOnly=true) public User getUserWithAuthorities()
-
removeOldPersistentTokens
@Scheduled(cron="0 0 0 * * ?") public void removeOldPersistentTokens()
Persistent Token are used for providing automatic authentication, they should be automatically deleted after 30 days.This is scheduled to get fired everyday, at midnight.
-
-