Interface IUserGroupRepository
Namespace: Umbraco.Cms.Core.Persistence.Repositories
Assembly: Umbraco.Core.dll
Syntax
public interface IUserGroupRepository : IReadWriteQueryRepository<int, IUserGroup>, IReadRepository<int, IUserGroup>, IWriteRepository<IUserGroup>, IQueryRepository<IUserGroup>, IRepository
Methods
View SourceAddOrUpdateGroupWithUsers(IUserGroup, int[]?)
Used to add or update a user group and assign users to it
Declaration
void AddOrUpdateGroupWithUsers(IUserGroup userGroup, int[]? userIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IUserGroup | userGroup | |
| int[] | userIds |
AssignGroupPermission(int, string, params int[])
Assigns the same permission set for a single group to any number of entities
Declaration
void AssignGroupPermission(int groupId, string permission, params int[] entityIds)
Parameters
| Type | Name | Description |
|---|---|---|
| int | groupId | Id of group |
| string | permission | Permissions as enumerable list of char |
| int[] | entityIds | Specify the nodes to replace permissions for |
Get(string)
Gets a group by it's alias
Declaration
IUserGroup? Get(string alias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | alias |
Returns
| Type | Description |
|---|---|
| IUserGroup |
GetGroupsAssignedToSection(string)
This is useful when an entire section is removed from config
Declaration
IEnumerable<IUserGroup> GetGroupsAssignedToSection(string sectionAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sectionAlias |
Returns
| Type | Description |
|---|---|
| IEnumerable<IUserGroup> |
GetPermissions(int[], params int[])
Gets explicitly defined permissions for the group for specified entities
Declaration
EntityPermissionCollection GetPermissions(int[] groupIds, params int[] entityIds)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | groupIds | |
| int[] | entityIds | Array of entity Ids, if empty will return permissions for the group for all entities |
Returns
| Type | Description |
|---|---|
| EntityPermissionCollection |
GetPermissions(IReadOnlyUserGroup[]?, bool, params int[])
Gets explicit and default permissions (if requested) permissions for the group for specified entities
Declaration
EntityPermissionCollection GetPermissions(IReadOnlyUserGroup[]? groups, bool fallbackToDefaultPermissions, params int[] nodeIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyUserGroup[] | groups | |
| bool | fallbackToDefaultPermissions | If true will include the group's default permissions if no permissions are explicitly assigned |
| int[] | nodeIds | Array of entity Ids, if empty will return permissions for the group for all entities |
Returns
| Type | Description |
|---|---|
| EntityPermissionCollection |
ReplaceGroupPermissions(int, ISet<string>, params int[])
Replaces the same permission set for a single group to any number of entities
Declaration
void ReplaceGroupPermissions(int groupId, ISet<string> permissions, params int[] entityIds)
Parameters
| Type | Name | Description |
|---|---|---|
| int | groupId | Id of group |
| ISet<string> | permissions | Permissions as enumerable list of char |
| int[] | entityIds | Specify the nodes to replace permissions for. If nothing is specified all permissions are removed. |