Class UserGroupCache
Cache holding information about the users (e.g. associates) user groups
Inherited Members
Namespace: SuperOffice.CRM.Security
Assembly: SoDataBase.dll
Syntax
[CacheV2("Database", 0)]
public sealed class UserGroupCache : CacheBaseV2, IFlushableV2, IDisposable
Properties
TableNames
Cache holding information about the users (e.g. associates) user groups
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<Int32> | All groups that an associate belongs to. |
GetAllGroupsForAssociate(Int32)
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 |
---|---|---|
Int32 | associateId | Associate id for the associate to check for. |
Returns
Type | Description |
---|---|
IEnumerable<Int32> | All groups that an associate belongs to. |
GetAssociatesInGroup(Int32)
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 |
---|---|---|
Int32 | userGroupId | Group id |
Returns
Type | Description |
---|---|
IEnumerable<Int32> | 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 |
---|---|
Int32 |
GetCurrent()
Obtain an instance of the cache
Declaration
public static UserGroupCache GetCurrent()
Returns
Type | Description |
---|---|
UserGroupCache |
GetDefaultUserGroup()
Get the default user group for the logged in associate.
Declaration
public int GetDefaultUserGroup()
Returns
Type | Description |
---|---|
Int32 | Defualt usergroup for the associate. 0 means that there are no usergroups. |
GetDefaultUserGroup(Int32)
Get the default user group for an associate.
Declaration
public int GetDefaultUserGroup(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | AssociateId for the associate to get the usergroup for. |
Returns
Type | Description |
---|---|
Int32 | Defualt usergroup for the associate. 0 means that there are no usergroups. |
GetGroupRelationToUser(Int32)
Get the group relation from the currently logged on user to another user.
Declaration
public UserGroupCache.GroupRelation GetGroupRelationToUser(int toAssociateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | toAssociateId | The associate owning the item to check for. |
Returns
Type | Description |
---|---|
UserGroupCache.GroupRelation | Kind of relation to the group. |
GetGroupRelationToUser(Int32, Int32)
Cache holding information about the users (e.g. associates) user groups
Declaration
public UserGroupCache.GroupRelation GetGroupRelationToUser(int fromAssociateId, int toAssociateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | fromAssociateId | |
Int32 | toAssociateId |
Returns
Type | Description |
---|---|
UserGroupCache.GroupRelation |
GetGroupRelationToUser(Int32, Int32, out Int32)
Get the group relation between two users.
Declaration
public UserGroupCache.GroupRelation GetGroupRelationToUser(int fromAssociateId, int toAssociateId, out int firstCommonGroup)
Parameters
Type | Name | Description |
---|---|---|
Int32 | fromAssociateId | The current associate. |
Int32 | toAssociateId | The associate owning the item to check for. |
Int32 | 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<Int32> | List of secondary groups the logged in user is member of. |
GetSecondaryGroupsForAssociate(Int32)
Get secondary groups that a given associate is member of.
Declaration
public IEnumerable<int> GetSecondaryGroupsForAssociate(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate id for the user to get groups for. |
Returns
Type | Description |
---|---|
IEnumerable<Int32> | List of secondary groups the associate is member of. |
GetUserGroup(Int32)
Get a UserGroupRecordData from it's primary key.
Declaration
public UserGroupRecordData GetUserGroup(int userGroupId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | 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<Int32> | Array, may be empty but never null |
IsAssociateInGroup(Int32)
Check if the currently logged on associate is member of a group.
Declaration
public bool IsAssociateInGroup(int userGroupId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | userGroupId | Usergroup to check membership in. |
Returns
Type | Description |
---|---|
Boolean | True if the user is member of the UserGroup. |
IsAssociateInGroup(Int32, Int32)
Check if an associate is member of a group.
Declaration
public bool IsAssociateInGroup(int associateId, int userGroupId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to check membership for. |
Int32 | userGroupId | Usergroup to check membership in. |
Returns
Type | Description |
---|---|
Boolean | 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()