Table of Contents

Class UserService

Namespace
Dynamicweb.Security.UserManagement
Assembly
Dynamicweb.Core.dll
public class UserService : ICacheStorage<int, User>, ICacheStorage<int>, ICacheStorage
Inheritance
UserService
Implements
Inherited Members

Properties

Info

Information about the object cache

public CacheInformation Info { get; }

Property Value

CacheInformation

Methods

AddGroupRelations(User, IEnumerable<UserGroup>)

public virtual void AddGroupRelations(User user, IEnumerable<UserGroup> groups)

Parameters

user User
groups IEnumerable<UserGroup>

AddPointsToUserPointBalance(User, double)

public virtual void AddPointsToUserPointBalance(User user, double points)

Parameters

user User
points double

ApproveUser(string, out User?)

Finds a user with matching ApprovalKey and makes the user active.

public virtual 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 virtual 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 virtual void ClearCache()

Delete(User)

Deletes a user

public virtual void Delete(User user)

Parameters

user User

User to delete

ExpirePasswordRecoveryToken(User)

Expires password recovery token.

public virtual void ExpirePasswordRecoveryToken(User user)

Parameters

user User

GetUserByEmailAddress(string)

Finds a user by email address.

public virtual 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 virtual 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 virtual User? GetUserByExternalId(string externalId)

Parameters

externalId string

External identifier to search for.

Returns

User

GetUserById(int)

Gets a user by id.

public virtual 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 virtual User? GetUserByRecoveryToken(string recoveryToken)

Parameters

recoveryToken string

Recovery token to search for.

Returns

User

GetUserByUniqueId(Guid)

Finds a user by unique id.

public virtual User? GetUserByUniqueId(Guid uniqueId)

Parameters

uniqueId Guid

Unique identifier to search for.

Returns

User

GetUserByUserName(string)

Finds a user by username.

public virtual 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 virtual 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 virtual 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 virtual 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 virtual IEnumerable<int> GetUserIdsByGroupId(int groupId)

Parameters

groupId int

Identifier of a user group.

Returns

IEnumerable<int>

GetUsersByCustomerNumber(string)

Gets users by customer number.

public virtual 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 virtual 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 virtual IEnumerable<User> GetUsersByGroupId(int groupId)

Parameters

groupId int

Identifier of a user group.

Returns

IEnumerable<User>

GetUsersById(IEnumerable<int>)

Gets users by id.

public virtual 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 virtual UserSearchResult GetUsersBySearch(UserSearchFilter searchFilter)

Parameters

searchFilter UserSearchFilter

The search filters.

Returns

UserSearchResult

GetUsersByUserName(string)

Gets users by user name. When several users have the same username, they are usually the same account - with different customer number and shop id

public virtual IEnumerable<User> GetUsersByUserName(string userName)

Parameters

userName string

User name of users to be retrieved.

Returns

IEnumerable<User>

IsValidUserName(User)

Checks if the username is valid for a given user.

public virtual 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 virtual void RemoveGroupRelations(User user)

Parameters

user User

RemoveGroupRelations(User, IEnumerable<UserGroup>)

public virtual void RemoveGroupRelations(User user, IEnumerable<UserGroup> groups)

Parameters

user User
groups IEnumerable<UserGroup>

Save(User)

Saves a user

public virtual 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.

SetCacheType<TObjectCache>()

Changes the storage container

public void SetCacheType<TObjectCache>() where TObjectCache : ServiceCache<int, User>

Type Parameters

TObjectCache

UpdateEmailAllowed(IEnumerable<User>, bool)

public virtual void UpdateEmailAllowed(IEnumerable<User> users, bool emailAllowed)

Parameters

users IEnumerable<User>
emailAllowed bool

UpdateInformationSentDate(IEnumerable<User>, DateTime)

public virtual void UpdateInformationSentDate(IEnumerable<User> users, DateTime informationSentDate)

Parameters

users IEnumerable<User>
informationSentDate DateTime

UpdateLastLogOnTime(User, DateTime)

public virtual void UpdateLastLogOnTime(User user, DateTime logOnTime)

Parameters

user User
logOnTime DateTime
To top