Table of Contents

Class UserGroupService

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

Properties

Info

Information about the object cache

public CacheInformation Info { get; }

Property Value

CacheInformation

Methods

AddUserRelations(UserGroup, IEnumerable<User>)

Adds user relations to a user group.

public virtual void AddUserRelations(UserGroup group, IEnumerable<User> users)

Parameters

group UserGroup

User group.

users IEnumerable<User>

Users to add.

AddUsersMissingFromAccounts(IEnumerable<string>)

Adds the active frontend users with one of the given customer numbers to each account that has the same customer number, when the user is not already a member.

public virtual int AddUsersMissingFromAccounts(IEnumerable<string> customerNumbers)

Parameters

customerNumbers IEnumerable<string>

The customer numbers to add memberships for; accounts and users with other customer numbers are left alone.

Returns

int

The number of memberships added. Zero when user accounts are not enabled.

Remarks

Memberships are only added, never removed. A membership an administrator removed is added again when the user still has the account's customer number.

AssignAccountCustomerNumber(UserGroup, IEnumerable<User>)

Gives users the customer number of an account they have been added to.

public virtual void AssignAccountCustomerNumber(UserGroup group, IEnumerable<User> users)

Parameters

group UserGroup

User group. Nothing happens unless it is an account with a customer number.

users IEnumerable<User>

Users to update.

Remarks

Only users without a customer number that the current user may edit are updated and saved. Existing customer numbers are kept, as changing one would hide the user's current account from them.

ClearCache()

Resets all keys to the default value for objects stored in the object cache

public virtual void ClearCache()

Delete(UserGroup)

Deletes a user group.

public virtual void Delete(UserGroup group)

Parameters

group UserGroup

User group to delete.

FindGroupByEmailDomain(string?)

Finds the first user group whose email address domain matches the domain of the given email.

public virtual UserGroup? FindGroupByEmailDomain(string? email)

Parameters

email string

The email address to match against group email domains.

Returns

UserGroup

GetGroupById(int)

Gets a user group by id.

public virtual UserGroup? GetGroupById(int id)

Parameters

id int

Identifier of a user group.

Returns

UserGroup

GetGroupIdsByUserId(int)

Gets user group ids associated with a given user id.

public virtual IEnumerable<int> GetGroupIdsByUserId(int userId)

Parameters

userId int

Identifier of a user.

Returns

IEnumerable<int>

GetGroupPathForUser(int)

Gets a group path for the passed user id. If the user is direct member of more than one group, it is the first group that is used for the path

public virtual string GetGroupPathForUser(int userId)

Parameters

userId int

Id of a user

Returns

string

GetGroups()

Gets all user groups.

public virtual IEnumerable<UserGroup> GetGroups()

Returns

IEnumerable<UserGroup>

GetGroupsByCustomerNumber(string)

public virtual IEnumerable<UserGroup> GetGroupsByCustomerNumber(string customerNumber)

Parameters

customerNumber string

Returns

IEnumerable<UserGroup>

GetGroupsById(IEnumerable<int>)

Gets user groups by id.

public virtual IEnumerable<UserGroup> GetGroupsById(IEnumerable<int> ids)

Parameters

ids IEnumerable<int>

Identifiers of user groups.

Returns

IEnumerable<UserGroup>

GetGroupsByIdWithSubgroups(IEnumerable<int>)

Gets user groups, including descendent groups, by ids.

public virtual IEnumerable<UserGroup> GetGroupsByIdWithSubgroups(IEnumerable<int> ids)

Parameters

ids IEnumerable<int>

Identifiers of user groups.

Returns

IEnumerable<UserGroup>

GetGroupsByParentGroupId(int)

Gets user groups by parent group id.

public virtual IEnumerable<UserGroup> GetGroupsByParentGroupId(int parentGroupId)

Parameters

parentGroupId int

Identifier of a parent user group.

Returns

IEnumerable<UserGroup>

GetGroupsBySystemName(string)

public virtual IEnumerable<UserGroup> GetGroupsBySystemName(string systemName)

Parameters

systemName string

Returns

IEnumerable<UserGroup>

GetGroupsByUserId(int)

Gets user groups associated with a given user id.

public virtual IEnumerable<UserGroup> GetGroupsByUserId(int userId)

Parameters

userId int

Identifier of a user.

Returns

IEnumerable<UserGroup>

RemoveSmartSearchRelations(Guid)

public virtual void RemoveSmartSearchRelations(Guid smartSearchId)

Parameters

smartSearchId Guid

RemoveUserRelations(UserGroup)

Removes all user relations from a user group.

public virtual void RemoveUserRelations(UserGroup group)

Parameters

group UserGroup

User group.

RemoveUserRelations(UserGroup, IEnumerable<User>)

Removes user relations from a group.

public virtual void RemoveUserRelations(UserGroup group, IEnumerable<User> users)

Parameters

group UserGroup

User group.

users IEnumerable<User>

Users to remove.

Save(UserGroup)

Saves a user group.

public virtual void Save(UserGroup group)

Parameters

group UserGroup

User group to save.

SetCacheType<TObjectCache>()

Changes the storage container

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

Type Parameters

TObjectCache

SetUserRelations(UserGroup, IEnumerable<User>)

Makes the members of a user group match the supplied users, adding only the missing relations and removing only the ones no longer wanted.

public virtual void SetUserRelations(UserGroup group, IEnumerable<User> users)

Parameters

group UserGroup

User group.

users IEnumerable<User>

The users the group should contain.

Remarks

Users that are members both before and after the call keep their membership uninterrupted.

SortUserRelations(UserGroup, IEnumerable<User>)

Sorts user relations within a specified user group according to an ordered list of users.

public virtual void SortUserRelations(UserGroup group, IEnumerable<User> orderedUsers)

Parameters

group UserGroup

The user group whose relations will be sorted.

orderedUsers IEnumerable<User>

An ordered collection of users defining the new relation order.

To top