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, Int32[])
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 | |
System.Int32[] | userIds |
AssignGroupPermission(Int32, Char, Int32[])
Assigns the same permission set for a single group to any number of entities
Declaration
void AssignGroupPermission(int groupId, char permission, params int[] entityIds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | groupId | Id of group |
System.Char | permission | Permissions as enumerable list of System.Char |
System.Int32[] | 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 |
---|---|---|
System.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 |
---|---|---|
System.String | sectionAlias |
Returns
Type | Description |
---|---|
IEnumerable<IUserGroup> |
GetPermissions(Int32[], Int32[])
Gets explicitly defined permissions for the group for specified entities
Declaration
EntityPermissionCollection GetPermissions(int[] groupIds, params int[] entityIds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | groupIds | |
System.Int32[] | entityIds | Array of entity Ids, if empty will return permissions for the group for all entities |
Returns
Type | Description |
---|---|
EntityPermissionCollection |
GetPermissions(IReadOnlyUserGroup[], Boolean, Int32[])
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 | |
System.Boolean | fallbackToDefaultPermissions | If true will include the group's default permissions if no permissions are explicitly assigned |
System.Int32[] | nodeIds | Array of entity Ids, if empty will return permissions for the group for all entities |
Returns
Type | Description |
---|---|
EntityPermissionCollection |
ReplaceGroupPermissions(Int32, Nullable<IEnumerable<Char>>, Int32[])
Replaces the same permission set for a single group to any number of entities
Declaration
void ReplaceGroupPermissions(int groupId, IEnumerable<char>? permissions, params int[] entityIds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | groupId | Id of group |
System.Nullable<IEnumerable<System.Char>> | permissions | Permissions as enumerable list of System.Char |
System.Int32[] | entityIds | Specify the nodes to replace permissions for. If nothing is specified all permissions are removed. |