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, ProtectedContentUtil protectedContentUtil, AuthorityRepository authorityRepository, TenantRepository tenantRepository, org.springframework.cache.CacheManager cacheManager, String passwordCheckRegExp, javax.persistence.EntityManager entityManager, int activationKeyValidity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<User>activateRegistration(String key)voidchangePassword(String currentClearTextPassword, String newPassword)voidcheckPassword(String password)Optional<User>completePasswordReset(String newPassword, String key)UsercreateUser(UserDTO userDTO)voiddeleteUser(String login)org.springframework.data.domain.Page<UserDTO>findSelection(Map<String,String[]> parameterMap)org.springframework.data.domain.Page<UserDTO>getAllManagedUsers(org.springframework.data.domain.Pageable pageable)List<String>getAuthorities()Gets a list of all the authorities.List<User>getUsersByRole(String role)Optional<User>getUserWithAuthorities()Optional<User>getUserWithAuthorities(Long id)Optional<User>getUserWithAuthoritiesByLogin(String login)UserregisterUser(UserDTO userDTO, String password, String activationKey)voidremoveNotActivatedUsers()Not activated users should be automatically deleted after 3 days.Optional<User>requestPasswordReset(String username)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, Long tenantId)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, ProtectedContentUtil protectedContentUtil, AuthorityRepository authorityRepository, TenantRepository tenantRepository, org.springframework.cache.CacheManager cacheManager, @Value("${ca3s.ui.password.check.regexp:^(?=.*\\d)(?=.*[a-z]).{6,100}$}") String passwordCheckRegExp, javax.persistence.EntityManager entityManager, @Value("${ca3s.ui.password.activation.keyValidity:7}") int activationKeyValidity)
-
-
Method Detail
-
updateUser
public void updateUser(String firstName, String lastName, String email, String langKey, String imageUrl, Long tenantId)
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.tenantId-
-
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).
-
getAuthorities
public List<String> getAuthorities()
Gets a list of all the authorities.- Returns:
- a list of all the authorities.
-
checkPassword
public void checkPassword(String password)
-
-