Table of Contents

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 User
groups 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

approvalKey string

Approval key

user User

Approved user, if approval succeeded; otherwise, null.

Returns

bool

true, if approval succeeded; otherwise, false.

ChangePassword(User, string)

Changes the user password.

public void ChangePassword(User user, string password)

Parameters

user User

The user.

password string

The new password.

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 User

User 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 string

User email address to search for.

Returns

User

GetUserByEmailAddress(string, string?)

Finds a user by email address and shop id.

public User? GetUserByEmailAddress(string emailAddress, string? shopId)

Parameters

emailAddress string

User email address to search for.

shopId string

Shop identifier to search for.

Returns

User

GetUserByExternalId(string)

Finds a user by external id.

public User? GetUserByExternalId(string externalId)

Parameters

externalId string

External identifier to search for.

Returns

User

GetUserById(int)

Gets a user by id.

public User? GetUserById(int id)

Parameters

id int

Identifier of a user to be retrieved.

Returns

User

GetUserByRecoveryToken(string)

Finds a user by recovery token.

public User? GetUserByRecoveryToken(string recoveryToken)

Parameters

recoveryToken string

Recovery token to search for.

Returns

User

GetUserByUniqueId(Guid)

Finds a user by unique id.

public User? GetUserByUniqueId(Guid uniqueId)

Parameters

uniqueId Guid

Unique identifier to search for.

Returns

User

GetUserByUserName(string)

Finds a user by username.

public User? GetUserByUserName(string username)

Parameters

username string

Username to search for.

Returns

User

GetUserByUserName(string, string?)

Finds a user by username and shop id.

public User? GetUserByUserName(string username, string? shopId)

Parameters

username string

Username to search for.

shopId string

Shop identifier to search for.

Returns

User

GetUserCountByGroupId(int)

Gets the number of users associated with a given user group.

public int GetUserCountByGroupId(int groupId)

Parameters

groupId int

Identifier of a user group.

Returns

int

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

IEnumerable<int>

GetUserIdsByGroupId(int)

Gets user the ids associated with a given user group id.

public IEnumerable<int> GetUserIdsByGroupId(int groupId)

Parameters

groupId int

Identifier of a user group.

Returns

IEnumerable<int>

GetUsersByCustomerNumber(string)

Gets users by customer number.

public IEnumerable<User> GetUsersByCustomerNumber(string customerNumber)

Parameters

customerNumber string

Customer number of users to be retrieved.

Returns

IEnumerable<User>

GetUsersByGroupId(IEnumerable<int>)

Gets users by group id.

public IEnumerable<User> GetUsersByGroupId(IEnumerable<int> groupIds)

Parameters

groupIds IEnumerable<int>

Identifiers of user groups.

Returns

IEnumerable<User>

GetUsersByGroupId(int)

Gets users by group id.

public IEnumerable<User> GetUsersByGroupId(int groupId)

Parameters

groupId int

Identifier of a user group.

Returns

IEnumerable<User>

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

IEnumerable<User>

GetUsersBySearch(UserSearchFilter)

Gets users by search filters provided.

public UserSearchResult GetUsersBySearch(UserSearchFilter searchFilter)

Parameters

searchFilter UserSearchFilter

The search filters.

Returns

UserSearchResult

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 User
groups IEnumerable<UserGroup>

Save(User)

Saves a user

public bool Save(User user)

Parameters

user User

User 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)

Parameters

user User
logOnTime DateTime
To top