Class UserGroupCache
Cache holding information about the users (e.g. associates) user groups
Inherited Members
Namespace: SuperOffice.CRM.Security
Assembly: SoDataBase.dll
Syntax
[CacheV2(0)]
public sealed class UserGroupCache : CacheBaseV2
Constructors
UserGroupCache()
Cache holding information about the users (e.g. associates) user groups
Declaration
public UserGroupCache()
Properties
TableNames
Gets the names of the table data that are cached in this cache. When these tables are updated the cache will be disposed so a new cache instance can take its place.
Declaration
protected override IEnumerable<string> TableNames { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
Overrides
Methods
GetAllGroupsForAssociate()
Get all groups (e.g. primary and secondary) that the logged in user belongs to.
Declaration
public IEnumerable<int> GetAllGroupsForAssociate()
Returns
Type | Description |
---|---|
IEnumerable<int> | All groups that an associate belongs to. |
GetAllGroupsForAssociate(int)
Get all groups (e.g. primary and secondary) that the associate represented by the associateId belongs to.
Declaration
public IEnumerable<int> GetAllGroupsForAssociate(int associateId)
Parameters
Type | Name | Description |
---|---|---|
int | associateId | Associate id for the associate to check for. |
Returns
Type | Description |
---|---|
IEnumerable<int> | All groups that an associate belongs to. |
GetAssociatesInGroup(int)
Get the id's of all associates in a group (primary or secondary group does not matter)
Declaration
public IEnumerable<int> GetAssociatesInGroup(int userGroupId)
Parameters
Type | Name | Description |
---|---|---|
int | userGroupId | Group id |
Returns
Type | Description |
---|---|
IEnumerable<int> | Array of associates, may be empty but never null |
GetCount()
Get the number of user groups in the system
Declaration
public int GetCount()
Returns
Type | Description |
---|---|
int |
GetDefaultUserGroup()
Get the default user group for the logged in associate.
Declaration
public int GetDefaultUserGroup()
Returns
Type | Description |
---|---|
int | Defualt usergroup for the associate. 0 means that there are no usergroups. |
GetDefaultUserGroup(int)
Get the default user group for an associate.
Declaration
public int GetDefaultUserGroup(int associateId)
Parameters
Type | Name | Description |
---|---|---|
int | associateId | AssociateId for the associate to get the usergroup for. |
Returns
Type | Description |
---|---|
int | Defualt usergroup for the associate. 0 means that there are no usergroups. |
GetGroupRelationToUser(int)
Get the group relation from the currently logged on user to another user.
Declaration
public UserGroupCache.GroupRelation GetGroupRelationToUser(int toAssociateId)
Parameters
Type | Name | Description |
---|---|---|
int | toAssociateId | The associate owning the item to check for. |
Returns
Type | Description |
---|---|
UserGroupCache.GroupRelation | Kind of relation to the group. |
GetGroupRelationToUser(int, int)
Cache holding information about the users (e.g. associates) user groups
Declaration
public UserGroupCache.GroupRelation GetGroupRelationToUser(int fromAssociateId, int toAssociateId)
Parameters
Type | Name | Description |
---|---|---|
int | fromAssociateId | |
int | toAssociateId |
Returns
Type | Description |
---|---|
UserGroupCache.GroupRelation |
GetGroupRelationToUser(int, int, out int)
Get the group relation between two users.
Declaration
public UserGroupCache.GroupRelation GetGroupRelationToUser(int fromAssociateId, int toAssociateId, out int firstCommonGroup)
Parameters
Type | Name | Description |
---|---|---|
int | fromAssociateId | The current associate. |
int | toAssociateId | The associate owning the item to check for. |
int | firstCommonGroup |
Returns
Type | Description |
---|---|
UserGroupCache.GroupRelation | Kind of relation to the group. |
GetSecondaryGroupsForAssociate()
Get secondary groups that the logged in user is member of.
Declaration
public IEnumerable<int> GetSecondaryGroupsForAssociate()
Returns
Type | Description |
---|---|
IEnumerable<int> | List of secondary groups the logged in user is member of. |
GetSecondaryGroupsForAssociate(int)
Get secondary groups that a given associate is member of.
Declaration
public IEnumerable<int> GetSecondaryGroupsForAssociate(int associateId)
Parameters
Type | Name | Description |
---|---|---|
int | associateId | Associate id for the user to get groups for. |
Returns
Type | Description |
---|---|
IEnumerable<int> | List of secondary groups the associate is member of. |
GetUserGroup(int)
Get a UserGroupRecordData from it's primary key.
Declaration
public UserGroupRecordData GetUserGroup(int userGroupId)
Parameters
Type | Name | Description |
---|---|---|
int | userGroupId | UserGroupId (also known as GroupIdx) |
Returns
Type | Description |
---|---|
UserGroupRecordData | Instance of the record. |
GetUserGroupIds()
Get all user group id's as an array
Declaration
public IEnumerable<int> GetUserGroupIds()
Returns
Type | Description |
---|---|
IEnumerable<int> | Array, may be empty but never null |
IsAssociateInGroup(int)
Check if the currently logged on associate is member of a group.
Declaration
public bool IsAssociateInGroup(int userGroupId)
Parameters
Type | Name | Description |
---|---|---|
int | userGroupId | Usergroup to check membership in. |
Returns
Type | Description |
---|---|
bool | True if the user is member of the UserGroup. |
IsAssociateInGroup(int, int)
Check if an associate is member of a group.
Declaration
public bool IsAssociateInGroup(int associateId, int userGroupId)
Parameters
Type | Name | Description |
---|---|---|
int | associateId | Associate to check membership for. |
int | userGroupId | Usergroup to check membership in. |
Returns
Type | Description |
---|---|
bool | True if the user is member of the UserGroup. |
OnLoad()
Cache holding information about the users (e.g. associates) user groups
Declaration
protected override void OnLoad()
Overrides
OnLoadAsync(CancellationToken)
Cache holding information about the users (e.g. associates) user groups
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
protected override Task OnLoadAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |