@Service(value="userService") public class UserService<E extends User,D extends UserDao<E>> extends PersonService<E,D>
User model.AbstractCrudService| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.security.crypto.password.PasswordEncoder |
passwordEncoder
The autowired PasswordEncoder
|
protected RegistrationTokenService<RegistrationToken,RegistrationTokenDao<RegistrationToken>> |
registrationTokenService
Registration token service
|
protected RoleService<Role,RoleDao<Role>> |
roleService
Role service
|
permissionCollectionServicedao, logger| Modifier | Constructor and Description |
|---|---|
|
UserService()
Default constructor, which calls the type-constructor
|
protected |
UserService(Class<E> entityClass)
Constructor that sets the concrete entity class for the service.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activateUser(String tokenValue) |
E |
findByAccountName(String accountName)
Returns the user for the given (unique) account name.
|
E |
findByEmail(String email) |
Role |
getDefaultUserRole() |
Set<UserGroup> |
getGroupsOfUser(Integer userId) |
org.springframework.security.crypto.password.PasswordEncoder |
getPasswordEncoder() |
E |
getUserBySession() |
E |
persistNewUser(E user,
boolean encryptPassword)
Persists a new user in the database.
|
E |
registerUser(E user,
javax.servlet.http.HttpServletRequest request)
Registers a new user.
|
void |
setDao(D dao)
We have to use
Qualifier to define the correct dao here. |
void |
setDefaultUserRole(Role defaultUserRole) |
void |
setPasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder) |
void |
updatePassword(E user,
String rawPassword) |
addAndSaveGroupPermissions, addAndSaveUserPermissions, findAllUserGroupPermissionsOfUserGroup, findAllUserPermissionsOfUser, getPermissionCollectionService, removeAndSaveGroupPermissions, removeAndSaveUserPermissions, setPermissionCollectionServicedelete, findAll, findAllRestricted, findAllWhereFieldEquals, findAllWithCollectionContaining, findById, findBySimpleFilter, loadById, saveOrUpdate, updatePartialWithJsonNodegetDao, getEntityClass@Autowired protected RegistrationTokenService<RegistrationToken,RegistrationTokenDao<RegistrationToken>> registrationTokenService
@Autowired protected RoleService<Role,RoleDao<Role>> roleService
@Autowired protected org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
public UserService()
@Autowired @Qualifier(value="userDao") public void setDao(D dao)
Qualifier to define the correct dao here.
Otherwise, spring can not decide which dao has to be autowired here
as there are multiple candidates.@PostAuthorize(value="hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#accountName, \'READ\')") @Transactional(readOnly=true) public E findByAccountName(String accountName)
accountName - A unique account name.@PostAuthorize(value="hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#email, \'READ\')") @Transactional(readOnly=true) public E findByEmail(String email)
email - public E registerUser(E user, javax.servlet.http.HttpServletRequest request) throws Exception
user - A user with an UNencrypted password (!)request - Exceptionpublic E persistNewUser(E user, boolean encryptPassword)
user - The user to createencryptPassword - Whether or not the current password of the user object should
be encrypted or not before the object is persisted in the dbpublic void updatePassword(E user, String rawPassword) throws Exception
user - rawPassword - Exception@Transactional(readOnly=true) public E getUserBySession()
@PostFilter(value="hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(filterObject, \'READ\')") @Transactional(readOnly=true) public Set<UserGroup> getGroupsOfUser(Integer userId) throws Exception
userId - Exceptionpublic org.springframework.security.crypto.password.PasswordEncoder getPasswordEncoder()
public void setPasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
passwordEncoder - the passwordEncoder to setpublic Role getDefaultUserRole()
public void setDefaultUserRole(Role defaultUserRole)
defaultUserRole - the defaultUserRole to setCopyright © 2020 terrestris GmbH & Co. KG. All rights reserved.