public class DefaultUserService extends AbstractBusinessService implements UserService
AbstractService.SerializableDTOmodelService, sessionService, txManagertenant| Constructor and Description |
|---|
DefaultUserService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assurePasswordCompliance(UserModel user,
String plainPassword,
String encoding) |
EmployeeModel |
getAdminUser()
Returns always the admin user.
|
UserGroupModel |
getAdminUserGroup()
Returns always the admin user group.
|
Set<UserGroupModel> |
getAllGroups(UserModel user)
Deprecated.
|
Collection<TitleModel> |
getAllTitles()
Returns all
TitleModels in the system. |
Set<UserGroupModel> |
getAllUserGroupsForUser(UserModel user)
Gets all user groups for the given user.
|
<T extends UserGroupModel> |
getAllUserGroupsForUser(UserModel user,
Class<T> clazz)
Gets all user groups for the given user and specified (result) class.
|
<T extends UserGroupModel> |
getAllUserGroupsForUserGroup(UserGroupModel userGroup,
Class<T> clazz)
Gets all user groups for the given user group and specified (result) class.
|
CustomerModel |
getAnonymousUser()
Returns always the anonymous user.
|
UserModel |
getCurrentUser()
Returns the current user from the
Session. |
String |
getDefaultPasswordEncoding() |
String |
getPassword(String userId)
If possible returns the decoded password from the given user.
|
String |
getPassword(UserModel user)
Returns for the given user the decoded password if this is possible.
|
protected String |
getRealEncoding(String optionalEncoding) |
TitleModel |
getTitleForCode(String code)
Returns the
TitleModel for the specified code. |
UserModel |
getUser(String uid)
Deprecated.
|
List<AbstractUserAuditModel> |
getUserAudits(UserModel user)
Gets audit information about user previous password hashes.
|
UserModel |
getUserForUID(String userId)
Returns the
UserModel for the specified userId |
<T extends UserModel> |
getUserForUID(String userId,
Class<T> clazz)
Returns for the specified
userId and the specified (result) class the found user in the specified
class. |
UserGroupModel |
getUserGroup(String groupId)
Deprecated.
|
UserGroupModel |
getUserGroupForUID(String uid)
Returns the
UserGroupModel for the specified uid. |
<T extends UserGroupModel> |
getUserGroupForUID(String uid,
Class<T> clazz)
Returns the
UserGroupModel for the specified uid and the specified (result) class. |
boolean |
isAdmin(UserModel user)
Checks if the given user has the admin role.
|
boolean |
isAdminEmployee(UserModel user)
Checks if the given user has the is the admin employee.
|
boolean |
isAdminGroup(UserGroupModel userGroup)
Checks if the given user group or it's super groups have the admin role.
|
boolean |
isAnonymousUser(UserModel user)
Checks if the given user is the anonymous customer.
|
boolean |
isMemberOfGroup(UserGroupModel member,
UserGroupModel groupToCheckFor)
Checks if the given
user group is a member of the specified groupToCheckFor or its super
groups. |
boolean |
isMemberOfGroup(UserGroupModel member,
UserGroupModel groupToCheckFor,
boolean includeSuperGroups)
Checks if the given
user group is a member of the specified groupToCheckFor or its super
groups if includeSubGroups is set to true. |
boolean |
isMemberOfGroup(UserModel member,
UserGroupModel groupToCheckFor)
Checks if the given
user is a member of the specified groupToCheckFor or its super groups. |
boolean |
isMemberOfGroup(UserModel member,
UserGroupModel groupToCheckFor,
boolean includeSuperGroups)
Checks if the given
user is a member of the specified groupToCheckFor or its super groups
if includeSubGroups is set to true. |
boolean |
isPasswordIdenticalToAudited(UserModel user,
String plainPassword,
UserPasswordChangeAuditModel audit)
Checks if password is the same as the previous password.
|
boolean |
isUserExisting(String uid)
Checks if for the specified
uid a user exists in the system. |
void |
setCurrentUser(UserModel user)
Sets the given user as current user on the
Session. |
void |
setDefaultPasswordEncoding(String defaultPasswordEncoding) |
void |
setEncodedPassword(UserModel user,
String encodedPassword)
Sets the encoded password to the given user.
|
void |
setEncodedPassword(UserModel user,
String encodedPassword,
String encoding)
Sets the encoded password to the given user.
|
void |
setEventService(EventService eventService) |
void |
setPassword(String userId,
String password)
Encodes the given plain text password with the default password encoding and set the encoded password to the given
user.
|
void |
setPassword(String userId,
String password,
String encoding)
Sets the password according to the given
encoding for the given user id. |
void |
setPassword(UserModel user,
String plainPassword)
Encodes the given plain text password with the user's password encoding (using the default encoding if the user
doesn't have one) and set the encoded password to the given user.
|
void |
setPassword(UserModel user,
String plainPassword,
String encoding)
Encodes the given plain text password with the given password encoding and set the encoded password to the given
user.
|
void |
setPasswordEncoderService(PasswordEncoderService passwordEncoderService) |
void |
setPasswordPolicyService(PasswordPolicyService passwordPolicyService) |
void |
setPasswordWithDefaultEncoding(UserModel user,
String plainPassword)
Encodes the given plain text password with the default password encoding and set the encoded password to the given
user.
|
void |
setSearchRestrictionService(SearchRestrictionService searchRestrictionService) |
void |
setTitleDao(TitleDao titleDao) |
void |
setUserAuditDao(UserAuditDao userAuditDao) |
void |
setUserDao(UserDao userDao) |
void |
setUserGroupDao(UserGroupDao userGroupDao) |
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerafterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, setTenantScope, writeReplace@Deprecated public UserModel getUser(String uid)
UserServiceUserModel by the specified userIdgetUser in interface UserServiceuid - the specified userIdUserModelpublic UserModel getUserForUID(String userId)
UserServiceUserModel for the specified userIdgetUserForUID in interface UserServiceuserId - the unique userId of the userUserModel or a subtype of it.public <T extends UserModel> T getUserForUID(String userId, Class<T> clazz)
UserServiceuserId and the specified (result) class the found user in the specified
class. Throws exception otherwise.getUserForUID in interface UserServiceuserId - The unique userId of the user to be searched for.clazz - The user must match the given class (employee, customer, ...). Can be a UserModel or any subtype
of it.public boolean isUserExisting(String uid)
UserServiceuid a user exists in the system.isUserExisting in interface UserServiceuid - of the usertrue if a user exists, otherwise false@Deprecated public UserGroupModel getUserGroup(String groupId)
UserServiceUserGroupModel by the specified userGroupIdgetUserGroup in interface UserServicegroupId - the specified userGroupIdUserGroupModel@Deprecated public Set<UserGroupModel> getAllGroups(UserModel user)
UserServicegetAllGroups in interface UserServicepublic UserModel getCurrentUser()
UserServiceSession.getCurrentUser in interface UserServiceUserModelpublic void setCurrentUser(UserModel user)
UserServiceSession.
After changing the user current user a AfterSessionUserChangeEvent is fired.
Please note: With hybris 4.3 this method doesn't trigger a call of
JaloSessionListener.afterSessionUserChange(de.hybris.platform.jalo.JaloSession, de.hybris.platform.jalo.user.User)
in the jalo-layer!
setCurrentUser in interface UserServiceuser - the user to set as currentpublic String getPassword(UserModel user) throws CannotDecodePasswordException, PasswordEncoderNotFoundException
UserServicegetPassword in interface UserServiceuser - the user where the password should be decodedCannotDecodePasswordException - if the encoded password UserModel.getEncodedPassword() cannot be decoded.PasswordEncoderNotFoundException - is thrown if given encoding does not match any password encoder in the systempublic void setPassword(UserModel user, String plainPassword, String encoding)
UserServicesetPassword in interface UserServiceuser - the encoded password is set to UserModel.setEncodedPassword(String)plainPassword - the plain text password for the userencoding - the password encidung, must existprotected void assurePasswordCompliance(UserModel user, String plainPassword, String encoding)
public void setPasswordWithDefaultEncoding(UserModel user, String plainPassword) throws PasswordEncoderNotFoundException
UserServicesetPasswordWithDefaultEncoding in interface UserServiceuser - the encoded password is set to UserModel.setEncodedPassword(String)plainPassword - the plain text password for the userPasswordEncoderNotFoundExceptionpublic String getPassword(String userId) throws CannotDecodePasswordException, PasswordEncoderNotFoundException
UserServicegetPassword in interface UserServiceuserId - the user ID from the userCannotDecodePasswordException - if decode of the password is not possible (example: MD5)PasswordEncoderNotFoundException - if for the given password encoding (see UserModel.getPasswordEncoding() no password encoder was
foundpublic void setPassword(String userId, String password) throws PasswordEncoderNotFoundException
UserServicesetPassword in interface UserServiceuserId - the user ID of the userpassword - the plain text passwordPasswordEncoderNotFoundException - if for the given password encoding (see UserModel.getPasswordEncoding() no password encoder was
foundpublic void setPassword(String userId, String password, String encoding) throws PasswordEncoderNotFoundException
UserServiceencoding for the given user id.setPassword in interface UserServiceuserId - the user IDpassword - the plain passwordencoding - the encoding to encode the given passwordPasswordEncoderNotFoundException - is thrown if given encoding does not match any password encoder in the systempublic UserGroupModel getUserGroupForUID(String uid)
UserServiceUserGroupModel for the specified uid.getUserGroupForUID in interface UserServiceuid - the unique uid of the groupUserGroupModel (or a subtype of it).public <T extends UserGroupModel> T getUserGroupForUID(String uid, Class<T> clazz)
UserServiceUserGroupModel for the specified uid and the specified (result) class.
The found user group must be an instance of the given class, otherwise an exception is thrown.
getUserGroupForUID in interface UserServiceuid - The unique uid of the user group to be searched for.clazz - The user group must match the given class. Can be a UserGroupModel or any subtype of it.UserGroupModelpublic Set<UserGroupModel> getAllUserGroupsForUser(UserModel user)
UserService
The Set of user groups is collected recursively.
getAllUserGroupsForUser in interface UserServiceuser - the given userSet of user groupspublic <T extends UserGroupModel> Set<T> getAllUserGroupsForUser(UserModel user, Class<T> clazz)
UserServiceclazz then this group is not in the result set. Use
UserService.getUserGroupForUID(String) if all groups are needed.
The Set of user groups is collected recursively.
getAllUserGroupsForUser in interface UserServiceuser - the given userclazz - the user group must match the given class. Can be a UserGroupModel or any subtype of it.Set of user groups which must be instances of the specified result classpublic <T extends UserGroupModel> Set<T> getAllUserGroupsForUserGroup(UserGroupModel userGroup, Class<T> clazz)
UserServiceclazz then this group is not in the result set. Use
UserService.getUserGroupForUID(String) if all groups are needed.
The Set of user groups is collected recursively.
getAllUserGroupsForUserGroup in interface UserServiceuserGroup - the given user groupclazz - the user group must match the given class. Can be a UserGroupModel or any subtype of it.Set of user groups which must be instances of the specified result classpublic List<AbstractUserAuditModel> getUserAudits(UserModel user)
UserServicegetUserAudits in interface UserServicepublic boolean isPasswordIdenticalToAudited(UserModel user, String plainPassword, UserPasswordChangeAuditModel audit)
UserServiceisPasswordIdenticalToAudited in interface UserServicetrue if password is the same as audit, otherwise falsepublic boolean isMemberOfGroup(UserModel member, UserGroupModel groupToCheckFor)
UserServiceuser is a member of the specified groupToCheckFor or its super groups.
The super groups are collected recursively.
isMemberOfGroup in interface UserServicemember - the user to checkgroupToCheckFor - the group(s) to be checked fortrue if the user is a member of this group, otherwise falsepublic boolean isMemberOfGroup(UserModel member, UserGroupModel groupToCheckFor, boolean includeSuperGroups)
UserServiceuser is a member of the specified groupToCheckFor or its super groups
if includeSubGroups is set to true.
The super groups are collected recursively.
isMemberOfGroup in interface UserServicemember - the user to checkgroupToCheckFor - the group(s) to be checked forincludeSuperGroups - should include super groups in searchtrue if the user is a member of this group, otherwise falsepublic boolean isMemberOfGroup(UserGroupModel member, UserGroupModel groupToCheckFor)
UserServiceuser group is a member of the specified groupToCheckFor or its super
groups.
The super groups are collected recursively.
isMemberOfGroup in interface UserServicemember - the user group to checkgroupToCheckFor - the group(s) to be checked fortrue if the user group is a member of this group, otherwise falsepublic boolean isMemberOfGroup(UserGroupModel member, UserGroupModel groupToCheckFor, boolean includeSuperGroups)
UserServiceuser group is a member of the specified groupToCheckFor or its super
groups if includeSubGroups is set to true.
The super groups are collected recursively.
isMemberOfGroup in interface UserServicemember - the user group to checkgroupToCheckFor - the group(s) to be checked forincludeSuperGroups - should include super groups in searchtrue if the user group is a member of this group, otherwise falsepublic Collection<TitleModel> getAllTitles()
UserServiceTitleModels in the system.getAllTitles in interface UserServiceTitleModel was found.public TitleModel getTitleForCode(String code)
UserServiceTitleModel for the specified code.getTitleForCode in interface UserServicecode - the unique code of the titlepublic EmployeeModel getAdminUser()
UserServicegetAdminUser in interface UserServiceEmployeeModelpublic UserGroupModel getAdminUserGroup()
UserServicegetAdminUserGroup in interface UserServiceUserGroupModelpublic boolean isAdmin(UserModel user)
UserService
The user is an admin if either the user is the admin employee or the user is a member of the admin user group (see
UserService.getAdminUserGroup()).
isAdmin in interface UserServiceuser - user to checktrue if the user is an admin, otherwise falsepublic boolean isAdminGroup(UserGroupModel userGroup)
UserServiceisAdminGroup in interface UserServiceuserGroup - user to checktrue if the user is an admin, otherwise falsepublic boolean isAdminEmployee(UserModel user)
UserServiceisAdminEmployee in interface UserServiceuser - user to checktrue if the user is an admin employee, otherwise falsepublic CustomerModel getAnonymousUser()
UserServicegetAnonymousUser in interface UserServiceCustomerModelpublic boolean isAnonymousUser(UserModel user)
UserServiceisAnonymousUser in interface UserServiceuser - the user to checktrue if the user is the anonymous customer, otherwise falsepublic void setEncodedPassword(UserModel user, String encodedPassword)
UserService
The encoding is taken form user or if null the system default encoding is used.
setEncodedPassword in interface UserServiceuser - the encoded password is set to UserModel.setEncodedPassword(String)encodedPassword - encoded password for the userpublic void setEncodedPassword(UserModel user, String encodedPassword, String encoding)
UserServicesetEncodedPassword in interface UserServiceuser - the encoded password is set to UserModel.setEncodedPassword(String)encodedPassword - encoded password for the userencoding - the password encodingpublic void setUserDao(UserDao userDao)
public void setUserGroupDao(UserGroupDao userGroupDao)
public void setTitleDao(TitleDao titleDao)
public void setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
public void setEventService(EventService eventService)
public void setPasswordEncoderService(PasswordEncoderService passwordEncoderService)
public String getDefaultPasswordEncoding()
public void setDefaultPasswordEncoding(String defaultPasswordEncoding)
public void setPassword(UserModel user, String plainPassword) throws PasswordEncoderNotFoundException
UserServicesetPassword in interface UserServiceuser - the encoded password is set to UserModel.setEncodedPassword(String)plainPassword - the plain text password for the userPasswordEncoderNotFoundException - if for the given password encoding (see UserModel.getPasswordEncoding() no password encoder was
foundpublic void setPasswordPolicyService(PasswordPolicyService passwordPolicyService)
public void setUserAuditDao(UserAuditDao userAuditDao)
Copyright © 2017 SAP SE. All Rights Reserved.