public interface UserService
| Modifier and Type | Method and Description |
|---|---|
EmployeeModel |
getAdminUser()
Returns always the admin user.
|
UserGroupModel |
getAdminUserGroup()
Returns always the admin user group.
|
Set<UserGroupModel> |
getAllGroups(UserModel user)
Deprecated.
wrong naming, please use
getAllUserGroupsForUser(UserModel) |
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 |
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.
|
TitleModel |
getTitleForCode(String code)
Returns the
TitleModel for the specified code. |
UserModel |
getUser(String userId)
Deprecated.
wrong naming, please use
getUserForUID(String) |
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 userGroupId)
Deprecated.
wrong naming, please use
getUserGroupForUID(String) |
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 |
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 |
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 |
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.
|
@Deprecated UserModel getUser(String userId)
getUserForUID(String)UserModel by the specified userIduserId - the specified userIdUserModelUnknownIdentifierException - if the user was not foundUserModel getUserForUID(String userId)
UserModel for the specified userIduserId - the unique userId of the userUserModel or a subtype of it.UnknownIdentifierException - if user was not foundIllegalArgumentException - if given userId was null<T extends UserModel> T getUserForUID(String userId, Class<T> clazz)
userId and the specified (result) class the found user in the specified
class. Throws exception otherwise.userId - 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.UnknownIdentifierException - if the user was not foundIllegalArgumentException - if given userId or given clazz was nullClassMismatchException - if a user was found by the given userId but did not match the provided clazzboolean isUserExisting(String uid)
uid a user exists in the system.uid - of the usertrue if a user exists, otherwise false@Deprecated UserGroupModel getUserGroup(String userGroupId)
getUserGroupForUID(String)UserGroupModel by the specified userGroupIduserGroupId - the specified userGroupIdUserGroupModelUnknownIdentifierException - if the userGroup was not foundUserGroupModel getUserGroupForUID(String uid)
UserGroupModel for the specified uid.uid - the unique uid of the groupUserGroupModel (or a subtype of it).UnknownIdentifierException - if user group was not foundIllegalArgumentException - if given uid was null<T extends UserGroupModel> T getUserGroupForUID(String uid, Class<T> clazz)
UserGroupModel 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.
uid - 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.UserGroupModelUnknownIdentifierException - if user group was not foundClassMismatchException - if a user group was found by the given uid but did not match the provided
clazzIllegalArgumentException - if given uid or given clazz was null@Deprecated Set<UserGroupModel> getAllGroups(UserModel user)
getAllUserGroupsForUser(UserModel)Set<UserGroupModel> getAllUserGroupsForUser(UserModel user)
The Set of user groups is collected recursively.
user - the given userSet of user groupsIllegalArgumentException - if given user is null<T extends UserGroupModel> Set<T> getAllUserGroupsForUser(UserModel user, Class<T> clazz)
clazz then this group is not in the result set. Use
getUserGroupForUID(String) if all groups are needed.
The Set of user groups is collected recursively.
user - 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 classIllegalArgumentException - if given user or given clazz are nullList<AbstractUserAuditModel> getUserAudits(UserModel user)
user - boolean isPasswordIdenticalToAudited(UserModel user, String plainPassword, UserPasswordChangeAuditModel audit)
plainPassword - audit - true if password is the same as audit, otherwise false<T extends UserGroupModel> Set<T> getAllUserGroupsForUserGroup(UserGroupModel userGroup, Class<T> clazz)
clazz then this group is not in the result set. Use
getUserGroupForUID(String) if all groups are needed.
The Set of user groups is collected recursively.
userGroup - 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 classIllegalArgumentException - if given user group or given clazz are nullboolean isMemberOfGroup(UserModel member, UserGroupModel groupToCheckFor)
user is a member of the specified groupToCheckFor or its super groups.
The super groups are collected recursively.
member - the user to checkgroupToCheckFor - the group(s) to be checked fortrue if the user is a member of this group, otherwise falseIllegalArgumentException - if the given user or the given groupToCheckFor are nullboolean isMemberOfGroup(UserModel member, UserGroupModel groupToCheckFor, boolean includeSuperGroups)
user is a member of the specified groupToCheckFor or its super groups
if includeSubGroups is set to true.
The super groups are collected recursively.
member - 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 falseIllegalArgumentException - if the given user or the given groupToCheckFor are nullboolean isMemberOfGroup(UserGroupModel member, UserGroupModel groupToCheckFor)
user group is a member of the specified groupToCheckFor or its super
groups.
The super groups are collected recursively.
member - the user group to checkgroupToCheckFor - the group(s) to be checked fortrue if the user group is a member of this group, otherwise falseIllegalArgumentException - if the given user group or the given groupToCheckFor are nullboolean isMemberOfGroup(UserGroupModel member, UserGroupModel groupToCheckFor, boolean includeSuperGroups)
user group is a member of the specified groupToCheckFor or its super
groups if includeSubGroups is set to true.
The super groups are collected recursively.
member - 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 falseIllegalArgumentException - if the given user group or the given groupToCheckFor are nullCollection<TitleModel> getAllTitles()
TitleModels in the system.TitleModel was found.TitleModel getTitleForCode(String code)
TitleModel for the specified code.code - the unique code of the titleUnknownIdentifierException - if a title was not foundIllegalArgumentException - if given code was nullAmbiguousIdentifierException - if for the given code too many title were foundEmployeeModel getAdminUser()
EmployeeModelUserGroupModel getAdminUserGroup()
UserGroupModelboolean isAdmin(UserModel user)
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
getAdminUserGroup()).
user - user to checktrue if the user is an admin, otherwise falseIllegalArgumentException - if the given is nullboolean isAdminGroup(UserGroupModel userGroup)
userGroup - user to checktrue if the user is an admin, otherwise falseIllegalArgumentException - if the given is nullboolean isAdminEmployee(UserModel user)
see getAdminUser()).
user - user to checktrue if the user is an admin employee, otherwise falseIllegalArgumentException - if the given is nullCustomerModel getAnonymousUser()
CustomerModelboolean isAnonymousUser(UserModel user)
user - the user to checktrue if the user is the anonymous customer, otherwise falseUserModel getCurrentUser()
Session.UserModelvoid setCurrentUser(UserModel user)
Session.
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!
user - the user to set as currentString getPassword(String userId) throws CannotDecodePasswordException, PasswordEncoderNotFoundException
userId - 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
foundIllegalArgumentException - if userID was nullUnknownIdentifierException - us user was not foundvoid setPassword(String userId, String password) throws PasswordEncoderNotFoundException
userId - the user ID of the userpassword - the plain text passwordPasswordEncoderNotFoundException - if for the given password encoding (see UserModel.getPasswordEncoding() no password encoder was
foundIllegalArgumentException - if userID was nullUnknownIdentifierException - us user was not foundvoid setPassword(String userId, String password, String encoding) throws PasswordEncoderNotFoundException
encoding for the given user id.userId - 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 systemvoid setPassword(UserModel user, String plainPassword, String encoding) throws PasswordEncoderNotFoundException
user - the encoded password is set to UserModel.setEncodedPassword(String)plainPassword - the plain text password for the userencoding - the password encidung, must existPasswordEncoderNotFoundException - if for the given password encoding (see UserModel.getPasswordEncoding() no password encoder was
foundvoid setPassword(UserModel user, String plainPassword) throws PasswordEncoderNotFoundException
user - 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
foundvoid setPasswordWithDefaultEncoding(UserModel user, String plainPassword) throws PasswordEncoderNotFoundException
user - the encoded password is set to UserModel.setEncodedPassword(String)plainPassword - the plain text password for the userPasswordEncoderNotFoundExceptionString getPassword(UserModel user) throws CannotDecodePasswordException, PasswordEncoderNotFoundException
user - 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 systemvoid setEncodedPassword(UserModel user, String encodedPassword)
The encoding is taken form user or if null the system default encoding is used.
user - the encoded password is set to UserModel.setEncodedPassword(String)encodedPassword - encoded password for the uservoid setEncodedPassword(UserModel user, String encodedPassword, String encoding)
user - the encoded password is set to UserModel.setEncodedPassword(String)encodedPassword - encoded password for the userencoding - the password encodingCopyright © 2017 SAP SE. All Rights Reserved.