Class UserService
- Namespace
- Dynamicweb.Security.UserManagement
- Assembly
- Dynamicweb.Core.dll
public sealed class UserService : ICacheStorage<int, User>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
UserService
- Implements
- Inherited Members
Methods
AddGroupRelations(User, IEnumerable<UserGroup>)
public void AddGroupRelations(User user, IEnumerable<UserGroup> groups)
Parameters
user
Usergroups
IEnumerable<UserGroup>
ApproveUser(string, out User?)
Finds a user with matching ApprovalKey and makes the user active.
public bool ApproveUser(string approvalKey, out User? user)
Parameters
Returns
- bool
true
, if approval succeeded; otherwise,false
.
ChangePassword(User, string)
Changes the user password.
public void ChangePassword(User user, string password)
Parameters
ClearCache()
Resets all keys to the default value for objects stored in the object cache
public void ClearCache()
Delete(User)
Deletes a user
public void Delete(User user)
Parameters
user
UserUser to delete
ExpirePasswordRecoveryToken(User)
Expires password recovery token.
public void ExpirePasswordRecoveryToken(User user)
Parameters
user
User
GetUserByEmailAddress(string)
Finds a user by email address.
public User? GetUserByEmailAddress(string emailAddress)
Parameters
emailAddress
stringUser email address to search for.
Returns
GetUserByEmailAddress(string, string?)
Finds a user by email address and shop id.
public User? GetUserByEmailAddress(string emailAddress, string? shopId)
Parameters
Returns
GetUserByExternalId(string)
Finds a user by external id.
public User? GetUserByExternalId(string externalId)
Parameters
externalId
stringExternal identifier to search for.
Returns
GetUserById(int)
Gets a user by id.
public User? GetUserById(int id)
Parameters
id
intIdentifier of a user to be retrieved.
Returns
GetUserByRecoveryToken(string)
Finds a user by recovery token.
public User? GetUserByRecoveryToken(string recoveryToken)
Parameters
recoveryToken
stringRecovery token to search for.
Returns
GetUserByUniqueId(Guid)
Finds a user by unique id.
public User? GetUserByUniqueId(Guid uniqueId)
Parameters
uniqueId
GuidUnique identifier to search for.
Returns
GetUserByUserName(string)
Finds a user by username.
public User? GetUserByUserName(string username)
Parameters
username
stringUsername to search for.
Returns
GetUserByUserName(string, string?)
Finds a user by username and shop id.
public User? GetUserByUserName(string username, string? shopId)
Parameters
Returns
GetUserCountByGroupId(int)
Gets the number of users associated with a given user group.
public int GetUserCountByGroupId(int groupId)
Parameters
groupId
intIdentifier of a user group.
Returns
GetUserIdsByGroupId(IEnumerable<int>)
Gets user the ids associated with given user group ids.
public IEnumerable<int> GetUserIdsByGroupId(IEnumerable<int> groupIds)
Parameters
groupIds
IEnumerable<int>Identifiers of user groups.
Returns
GetUserIdsByGroupId(int)
Gets user the ids associated with a given user group id.
public IEnumerable<int> GetUserIdsByGroupId(int groupId)
Parameters
groupId
intIdentifier of a user group.
Returns
GetUsersByCustomerNumber(string)
Gets users by customer number.
public IEnumerable<User> GetUsersByCustomerNumber(string customerNumber)
Parameters
customerNumber
stringCustomer number of users to be retrieved.
Returns
GetUsersByGroupId(IEnumerable<int>)
Gets users by group id.
public IEnumerable<User> GetUsersByGroupId(IEnumerable<int> groupIds)
Parameters
groupIds
IEnumerable<int>Identifiers of user groups.
Returns
GetUsersByGroupId(int)
Gets users by group id.
public IEnumerable<User> GetUsersByGroupId(int groupId)
Parameters
groupId
intIdentifier of a user group.
Returns
GetUsersById(IEnumerable<int>)
Gets users by id.
public IEnumerable<User> GetUsersById(IEnumerable<int> ids)
Parameters
ids
IEnumerable<int>Identifiers of users to be retrieved.
Returns
GetUsersBySearch(UserSearchFilter)
Gets users by search filters provided.
public UserSearchResult GetUsersBySearch(UserSearchFilter searchFilter)
Parameters
searchFilter
UserSearchFilterThe search filters.
Returns
IsValidUserName(User)
Checks if the username is valid for a given user.
public bool IsValidUserName(User user)
Parameters
user
User
Returns
- bool
True if the username is non-empty and not taken by another user, false otherwise
RemoveGroupRelations(User)
public void RemoveGroupRelations(User user)
Parameters
user
User
RemoveGroupRelations(User, IEnumerable<UserGroup>)
public void RemoveGroupRelations(User user, IEnumerable<UserGroup> groups)
Parameters
user
Usergroups
IEnumerable<UserGroup>
Save(User)
Saves a user
public bool Save(User user)
Parameters
user
UserUser to save
Returns
- bool
true
, if user is saved; otherwise,false
Remarks
User is not saved if username is not unique. Use IsValidUserName(User) to validate before saving.
UpdateEmailAllowed(IEnumerable<User>, bool)
public void UpdateEmailAllowed(IEnumerable<User> users, bool emailAllowed)
Parameters
users
IEnumerable<User>emailAllowed
bool
UpdateInformationSentDate(IEnumerable<User>, DateTime)
public void UpdateInformationSentDate(IEnumerable<User> users, DateTime informationSentDate)
Parameters
users
IEnumerable<User>informationSentDate
DateTime
UpdateLastLogOnTime(User, DateTime)
public void UpdateLastLogOnTime(User user, DateTime logOnTime)