Package de.trustable.ca3s.core.service
Class UserService
- java.lang.Object
-
- de.trustable.ca3s.core.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, AuthorityRepository authorityRepository, org.springframework.cache.CacheManager cacheManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<User>activateRegistration(String key)voidchangePassword(String currentClearTextPassword, String newPassword)Optional<User>completePasswordReset(String newPassword, String key)UsercreateUser(UserDTO userDTO)voiddeleteUser(String login)org.springframework.data.domain.Page<UserDTO>getAllManagedUsers(org.springframework.data.domain.Pageable pageable)List<String>getAuthorities()Gets a list of all the authorities.Optional<User>getUserWithAuthorities()Optional<User>getUserWithAuthorities(Long id)Optional<User>getUserWithAuthoritiesByLogin(String login)UserregisterUser(UserDTO userDTO, String password)voidremoveNotActivatedUsers()Not activated users should be automatically deleted after 3 days.Optional<User>requestPasswordReset(String mail)Optional<UserDTO>updateUser(UserDTO userDTO)Update all information for a specific user, and return the modified user.voidupdateUser(String firstName, String lastName, String email, String langKey, String imageUrl)Update basic information (first name, last name, email, language) for the current user.
-
-
-
Constructor Detail
-
UserService
public UserService(UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, AuthorityRepository authorityRepository, org.springframework.cache.CacheManager cacheManager)
-
-
Method Detail
-
updateUser
public void updateUser(String firstName, String lastName, String email, String langKey, String imageUrl)
Update basic information (first name, last name, email, language) for the current user.- Parameters:
firstName- first name of user.lastName- last name of user.email- email id of user.langKey- language key.imageUrl- image URL of user.
-
updateUser
public Optional<UserDTO> updateUser(UserDTO userDTO)
Update all information for a specific user, and return the modified user.- Parameters:
userDTO- user to update.- Returns:
- updated user.
-
deleteUser
public void deleteUser(String login)
-
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 Optional<User> getUserWithAuthorities(Long id)
-
removeNotActivatedUsers
@Scheduled(cron="0 0 1 * * ?") public void removeNotActivatedUsers()
Not activated users should be automatically deleted after 3 days.This is scheduled to get fired everyday, at 01:00 (am).
-
-