Interface IUserGroupService
Manages user groups.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IUserGroupService
Methods
View SourceAddUsersToUserGroupAsync(UsersToUserGroupManipulationModel, Guid)
Declaration
Task<Attempt<UserGroupOperationStatus>> AddUsersToUserGroupAsync(UsersToUserGroupManipulationModel addUsersModel, Guid performingUserKey)
Parameters
Type | Name | Description |
---|---|---|
UsersToUserGroupManipulationModel | addUsersModel | |
Guid | performingUserKey |
Returns
Type | Description |
---|---|
Task<Attempt<UserGroupOperationStatus>> |
CreateAsync(IUserGroup, Guid, Guid[])
Persists a new user group.
Declaration
Task<Attempt<IUserGroup, UserGroupOperationStatus>> CreateAsync(IUserGroup userGroup, Guid userKey, Guid[] groupMembersKeys = null)
Parameters
Type | Name | Description |
---|---|---|
IUserGroup | userGroup | The user group to create. |
Guid | userKey | The key of the user responsible for creating the group. |
Guid[] | groupMembersKeys | The keys of the users that should be part of the group when created. |
Returns
Type | Description |
---|---|
Task<Attempt<IUserGroup, UserGroupOperationStatus>> | An attempt indicating if the operation was a success as well as a more detailed UserGroupOperationStatus. |
DeleteAsync(Guid)
Declaration
virtual Task<Attempt<UserGroupOperationStatus>> DeleteAsync(Guid userGroupKey)
Parameters
Type | Name | Description |
---|---|---|
Guid | userGroupKey |
Returns
Type | Description |
---|---|
Task<Attempt<UserGroupOperationStatus>> |
DeleteAsync(ISet<Guid>)
Deletes a UserGroup
Declaration
Task<Attempt<UserGroupOperationStatus>> DeleteAsync(ISet<Guid> userGroupKeys)
Parameters
Type | Name | Description |
---|---|---|
ISet<Guid> | userGroupKeys | The keys of the user groups to delete. |
Returns
Type | Description |
---|---|
Task<Attempt<UserGroupOperationStatus>> | An attempt indicating if the operation was a success as well as a more detailed UserGroupOperationStatus. |
FilterAsync(Guid, String, Int32, Int32)
Performs filtering for user groups
Declaration
Task<Attempt<PagedModel<IUserGroup>, UserGroupOperationStatus>> FilterAsync(Guid userKey, string filter, int skip, int take)
Parameters
Type | Name | Description |
---|---|---|
Guid | userKey | The key of the performing (current) user. |
System.String | filter | The filter to apply. |
System.Int32 | skip | The amount of user groups to skip. |
System.Int32 | take | The amount of user groups to take. |
Returns
Type | Description |
---|---|
Task<Attempt<PagedModel<IUserGroup>, UserGroupOperationStatus>> | All matching user groups as an enumerable list of IUserGroup. |
Remarks
If the performing user is not an administrator, this method only returns groups that the performing user is a member of.
GetAllAsync(Int32, Int32)
Gets all user groups.
Declaration
Task<PagedModel<IUserGroup>> GetAllAsync(int skip, int take)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | skip | The amount of user groups to skip. |
System.Int32 | take | The amount of user groups to take. |
Returns
Type | Description |
---|---|
Task<PagedModel<IUserGroup>> | All user groups as an enumerable list of IUserGroup. |
GetAsync(Guid)
Gets a UserGroup by its key
Declaration
Task<IUserGroup> GetAsync(Guid key)
Parameters
Type | Name | Description |
---|---|---|
Guid | key | Key of the UserGroup to retrieve. |
Returns
Type | Description |
---|---|
Task<IUserGroup> | IUserGroup |
GetAsync(IEnumerable<Guid>)
Declaration
Task<IEnumerable<IUserGroup>> GetAsync(IEnumerable<Guid> keys)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Guid> | keys |
Returns
Type | Description |
---|---|
Task<IEnumerable<IUserGroup>> |
GetAsync(Int32)
Gets a UserGroup by its Id
Declaration
Task<IUserGroup> GetAsync(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the UserGroup to retrieve. |
Returns
Type | Description |
---|---|
Task<IUserGroup> | IUserGroup |
GetAsync(Int32[])
Gets all UserGroups matching an ID in the parameter list.
Declaration
Task<IEnumerable<IUserGroup>> GetAsync(params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | ids | Optional Ids of UserGroups to retrieve. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IUserGroup>> | An enumerable list of IUserGroup. |
GetAsync(String)
Gets a UserGroup by its Alias
Declaration
Task<IUserGroup> GetAsync(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias | Name of the UserGroup to retrieve. |
Returns
Type | Description |
---|---|
Task<IUserGroup> | IUserGroup |
GetAsync(String[])
Gets all UserGroups matching an alias in the parameter list.
Declaration
Task<IEnumerable<IUserGroup>> GetAsync(params string[] aliases)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | aliases | Alias of the UserGroup to retrieve. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IUserGroup>> |
RemoveUsersFromUserGroupAsync(UsersToUserGroupManipulationModel, Guid)
Declaration
Task<Attempt<UserGroupOperationStatus>> RemoveUsersFromUserGroupAsync(UsersToUserGroupManipulationModel removeUsersModel, Guid performingUserKey)
Parameters
Type | Name | Description |
---|---|---|
UsersToUserGroupManipulationModel | removeUsersModel | |
Guid | performingUserKey |
Returns
Type | Description |
---|---|
Task<Attempt<UserGroupOperationStatus>> |
UpdateAsync(IUserGroup, Guid)
Updates an existing user group.
Declaration
Task<Attempt<IUserGroup, UserGroupOperationStatus>> UpdateAsync(IUserGroup userGroup, Guid userKey)
Parameters
Type | Name | Description |
---|---|---|
IUserGroup | userGroup | The user group to update. |
Guid | userKey | The ID of the user responsible for updating the group. |
Returns
Type | Description |
---|---|
Task<Attempt<IUserGroup, UserGroupOperationStatus>> | An attempt indicating if the operation was a success as well as a more detailed UserGroupOperationStatus. |
UpdateUserGroupsOnUsersAsync(ISet<Guid>, ISet<Guid>)
Updates the users to have the groups specified.
Declaration
Task<Attempt<UserGroupOperationStatus>> UpdateUserGroupsOnUsersAsync(ISet<Guid> userGroupKeys, ISet<Guid> userKeys)
Parameters
Type | Name | Description |
---|---|---|
ISet<Guid> | userGroupKeys | The user groups the users should be part of. |
ISet<Guid> | userKeys | The user whose groups we want to alter. |
Returns
Type | Description |
---|---|
Task<Attempt<UserGroupOperationStatus>> | An attempt indicating if the operation was a success as well as a more detailed UserGroupOperationStatus. |