View Source
Interface IUserService
Defines the UserService, which is an easy access to operations involving IProfile and eventually
Users.
Assembly: Umbraco.Core.dll
Syntax
public interface IUserService : IMembershipUserService, IMembershipMemberService<IUser>, IService
Methods
View Source
AddClientIdAsync(Guid, string)
Declaration
Task<UserClientCredentialsOperationStatus> AddClientIdAsync(Guid userKey, string clientId)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
|
| string |
clientId |
|
Returns
View Source
AssignUserGroupPermission(int, string, params int[])
Assigns the same permission set for a single user group to any number of entities
Declaration
void AssignUserGroupPermission(int groupId, string permission, params int[] entityIds)
Parameters
| Type |
Name |
Description |
| int |
groupId |
Id of the group
|
| string |
permission |
|
| int[] |
entityIds |
Specify the nodes to replace permissions for
|
View Source
ChangePasswordAsync(Guid, ChangeUserPasswordModel)
Declaration
Task<Attempt<PasswordChangedModel, UserOperationStatus>> ChangePasswordAsync(Guid performingUserKey, ChangeUserPasswordModel model)
Parameters
Returns
View Source
ClearAvatarAsync(Guid)
Declaration
Task<UserOperationStatus> ClearAvatarAsync(Guid userKey)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
|
Returns
View Source
ClearLoginSession(Guid)
Removes the session's validity
Declaration
void ClearLoginSession(Guid sessionId)
Parameters
| Type |
Name |
Description |
| Guid |
sessionId |
|
View Source
ClearLoginSessions(int)
Removes all valid sessions for the user
Declaration
int ClearLoginSessions(int userId)
Parameters
| Type |
Name |
Description |
| int |
userId |
|
Returns
View Source
CreateAsync(Guid, UserCreateModel, bool)
Creates a user based in a create model and persists it to the database.
Declaration
Task<Attempt<UserCreationResult, UserOperationStatus>> CreateAsync(Guid performingUserKey, UserCreateModel model, bool approveUser = false)
Parameters
| Type |
Name |
Description |
| Guid |
performingUserKey |
The key of the user performing the operation.
|
| UserCreateModel |
model |
Model to create the user from.
|
| bool |
approveUser |
Specifies if the user should be enabled be default. Defaults to false.
|
Returns
View Source
CreateInitialPasswordAsync(Guid, string, string)
Declaration
Task<Attempt<PasswordChangedModel, UserOperationStatus>> CreateInitialPasswordAsync(Guid userKey, string token, string password)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
|
| string |
token |
|
| string |
password |
|
Returns
View Source
CreateLoginSession(int, string)
Creates a database entry for starting a new login session for a user
Declaration
Guid CreateLoginSession(int userId, string requestingIpAddress)
Parameters
| Type |
Name |
Description |
| int |
userId |
|
| string |
requestingIpAddress |
|
Returns
View Source
Delete(IUser, bool)
Deletes or disables a User
Declaration
void Delete(IUser user, bool deletePermanently)
Parameters
| Type |
Name |
Description |
| IUser |
user |
IUser to delete
|
| bool |
deletePermanently |
True to permanently delete the user, False to disable the user
|
View Source
DeleteAsync(Guid, ISet<Guid>)
Declaration
Task<UserOperationStatus> DeleteAsync(Guid performingUserKey, ISet<Guid> keys)
Parameters
| Type |
Name |
Description |
| Guid |
performingUserKey |
|
| ISet<Guid> |
keys |
|
Returns
View Source
DeleteAsync(Guid, Guid)
Declaration
Task<UserOperationStatus> DeleteAsync(Guid performingUserKey, Guid key)
Parameters
| Type |
Name |
Description |
| Guid |
performingUserKey |
|
| Guid |
key |
|
Returns
View Source
DeleteSectionFromAllUserGroups(string)
Removes a specific section from all user groups
Declaration
void DeleteSectionFromAllUserGroups(string sectionAlias)
Parameters
| Type |
Name |
Description |
| string |
sectionAlias |
Alias of the section to remove
|
View Source
DisableAsync(Guid, ISet<Guid>)
Declaration
Task<UserOperationStatus> DisableAsync(Guid performingUserKey, ISet<Guid> keys)
Parameters
| Type |
Name |
Description |
| Guid |
performingUserKey |
|
| ISet<Guid> |
keys |
|
Returns
View Source
EnableAsync(Guid, ISet<Guid>)
Declaration
Task<UserOperationStatus> EnableAsync(Guid performingUserKey, ISet<Guid> keys)
Parameters
| Type |
Name |
Description |
| Guid |
performingUserKey |
|
| ISet<Guid> |
keys |
|
Returns
View Source
FilterAsync(Guid, UserFilter, int, int, UserOrder, Direction)
Declaration
Task<Attempt<PagedModel<IUser>, UserOperationStatus>> FilterAsync(Guid userKey, UserFilter filter, int skip = 0, int take = 100, UserOrder orderBy = UserOrder.UserName, Direction orderDirection = Direction.Ascending)
Parameters
Returns
View Source
FindByClientIdAsync(string)
Declaration
Task<IUser?> FindByClientIdAsync(string clientId)
Parameters
| Type |
Name |
Description |
| string |
clientId |
|
Returns
| Type |
Description |
| Task<IUser> |
|
View Source
GetAll(long, int, out long, string, Direction, UserState[]?, string[]?, string?)
Declaration
IEnumerable<IUser> GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, UserState[]? userState = null, string[]? userGroups = null, string? filter = null)
Parameters
| Type |
Name |
Description |
| long |
pageIndex |
|
| int |
pageSize |
|
| long |
totalRecords |
|
| string |
orderBy |
|
| Direction |
orderDirection |
|
| UserState[] |
userState |
|
| string[] |
userGroups |
A filter to only include user that belong to these user groups
|
| string |
filter |
|
Returns
| Type |
Description |
| IEnumerable<IUser> |
|
View Source
GetAll(long, int, out long, string, Direction, UserState[]?, string[]?, string[]?, IQuery<IUser>?)
Declaration
IEnumerable<IUser> GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, UserState[]? userState = null, string[]? includeUserGroups = null, string[]? excludeUserGroups = null, IQuery<IUser>? filter = null)
Parameters
| Type |
Name |
Description |
| long |
pageIndex |
|
| int |
pageSize |
|
| long |
totalRecords |
|
| string |
orderBy |
|
| Direction |
orderDirection |
|
| UserState[] |
userState |
|
| string[] |
includeUserGroups |
A filter to only include user that belong to these user groups
|
| string[] |
excludeUserGroups |
A filter to only include users that do not belong to these user groups
|
| IQuery<IUser> |
filter |
|
Returns
| Type |
Description |
| IEnumerable<IUser> |
|
View Source
GetAllAsync(Guid, int, int)
Gets all users that the requesting user is allowed to see.
Declaration
Task<Attempt<PagedModel<IUser>?, UserOperationStatus>> GetAllAsync(Guid performingUserKey, int skip, int take)
Parameters
| Type |
Name |
Description |
| Guid |
performingUserKey |
The Key of the user requesting the users.
|
| int |
skip |
Amount to skip.
|
| int |
take |
Amount to take.
|
Returns
View Source
GetAllInGroup(int?)
Gets a list of IUser objects associated with a given group
Declaration
IEnumerable<IUser> GetAllInGroup(int? groupId)
Parameters
| Type |
Name |
Description |
| int? |
groupId |
Id of group
|
Returns
| Type |
Description |
| IEnumerable<IUser> |
System.Collections.Generic.IEnumerable<T>
|
View Source
GetAllNotInGroup(int)
Gets a list of IUser objects not associated with a given group
Declaration
IEnumerable<IUser> GetAllNotInGroup(int groupId)
Parameters
| Type |
Name |
Description |
| int |
groupId |
Id of group
|
Returns
| Type |
Description |
| IEnumerable<IUser> |
System.Collections.Generic.IEnumerable<T>
|
View Source
GetAsync(IEnumerable<Guid>)
Declaration
Task<IEnumerable<IUser>> GetAsync(IEnumerable<Guid> keys)
Parameters
| Type |
Name |
Description |
| IEnumerable<Guid> |
keys |
|
Returns
| Type |
Description |
| Task<IEnumerable<IUser>> |
|
View Source
GetAsync(Guid)
Declaration
Task<IUser?> GetAsync(Guid key)
Parameters
| Type |
Name |
Description |
| Guid |
key |
The GUID key of the user.
|
Returns
| Type |
Description |
| Task<IUser> |
The found user, or null if nothing was found.
|
View Source
GetClientIdsAsync(Guid)
Declaration
Task<IEnumerable<string>> GetClientIdsAsync(Guid userKey)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
|
Returns
| Type |
Description |
| Task<IEnumerable<string>> |
|
View Source
GetDocumentPermissionsAsync(Guid, IEnumerable<Guid>)
Get explicitly assigned media permissions for a user and node keys.
Declaration
Task<Attempt<IEnumerable<NodePermissions>, UserOperationStatus>> GetDocumentPermissionsAsync(Guid userKey, IEnumerable<Guid> contentKeys)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
Key of user to retrieve permissions for.
|
| IEnumerable<Guid> |
contentKeys |
The keys of the content to get permissions for.
|
Returns
View Source
GetLinkedLoginsAsync(Guid)
Declaration
Task<Attempt<ICollection<IIdentityUserLogin>, UserOperationStatus>> GetLinkedLoginsAsync(Guid userKey)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
|
Returns
View Source
Get explicitly assigned content permissions for a user and node keys.
Declaration
Task<Attempt<IEnumerable<NodePermissions>, UserOperationStatus>> GetMediaPermissionsAsync(Guid userKey, IEnumerable<Guid> mediaKeys)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
Key of user to retrieve permissions for.
|
| IEnumerable<Guid> |
mediaKeys |
The keys of the media to get permissions for.
|
Returns
View Source
GetPermissions(IUser?, params int[])
Get explicitly assigned permissions for a user and optional node ids
Declaration
EntityPermissionCollection GetPermissions(IUser? user, params int[] nodeIds)
Parameters
| Type |
Name |
Description |
| IUser |
user |
User to retrieve permissions for
|
| int[] |
nodeIds |
Specifying nothing will return all user permissions for all nodes that have explicit permissions
defined
|
Returns
View Source
GetPermissions(IUserGroup?[], bool, params int[])
Get explicitly assigned permissions for groups and optional node Ids
Declaration
EntityPermissionCollection GetPermissions(IUserGroup?[] groups, bool fallbackToDefaultPermissions, params int[] nodeIds)
Parameters
| Type |
Name |
Description |
| IUserGroup[] |
groups |
|
| bool |
fallbackToDefaultPermissions |
Flag indicating if we want to include the default group permissions for each result if there are not explicit
permissions set
|
| int[] |
nodeIds |
Specifying nothing will return all permissions for all nodes
|
Returns
View Source
GetPermissionsAsync(Guid, params Guid[])
Get explicitly assigned permissions for a user and node keys.
Declaration
Task<Attempt<IEnumerable<NodePermissions>, UserOperationStatus>> GetPermissionsAsync(Guid userKey, params Guid[] nodeKeys)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
Key of user to retrieve permissions for.
|
| Guid[] |
nodeKeys |
The keys of the nodes to get permissions for.
|
Returns
View Source
GetPermissionsForPath(IUser?, string?)
Gets the implicit/inherited permissions for the user for the given path
Declaration
EntityPermissionSet GetPermissionsForPath(IUser? user, string? path)
Parameters
| Type |
Name |
Description |
| IUser |
user |
User to check permissions for
|
| string |
path |
Path to check permissions for
|
Returns
View Source
GetPermissionsForPath(IUserGroup[], string, bool)
Gets the permissions for the provided groups and path
Declaration
EntityPermissionSet GetPermissionsForPath(IUserGroup[] groups, string path, bool fallbackToDefaultPermissions = false)
Parameters
| Type |
Name |
Description |
| IUserGroup[] |
groups |
|
| string |
path |
Path to check permissions for
|
| bool |
fallbackToDefaultPermissions |
Flag indicating if we want to include the default group permissions for each result if there are not explicit
permissions set
|
Returns
View Source
GetProfileById(int)
Gets an IProfile by User Id.
Declaration
IProfile? GetProfileById(int id)
Parameters
| Type |
Name |
Description |
| int |
id |
Id of the User to retrieve
|
Returns
View Source
GetProfileByUserName(string)
Gets a profile by username
Declaration
IProfile? GetProfileByUserName(string username)
Parameters
| Type |
Name |
Description |
| string |
username |
Username
|
Returns
View Source
GetUserById(int)
Declaration
IUser? GetUserById(int id)
Parameters
| Type |
Name |
Description |
| int |
id |
Id of the user to retrieve
|
Returns
View Source
GetUserStates()
This is basically facets of UserStates key = state, value = count
Declaration
IDictionary<UserState, int> GetUserStates()
Returns
View Source
GetUsersById(params int[]?)
Declaration
IEnumerable<IUser> GetUsersById(params int[]? ids)
Parameters
| Type |
Name |
Description |
| int[] |
ids |
Ids of the users to retrieve
|
Returns
View Source
InviteAsync(Guid, UserInviteModel)
Declaration
Task<Attempt<UserInvitationResult, UserOperationStatus>> InviteAsync(Guid performingUserKey, UserInviteModel model)
Parameters
Returns
View Source
RemoveClientIdAsync(Guid, string)
Declaration
Task<bool> RemoveClientIdAsync(Guid userKey, string clientId)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
|
| string |
clientId |
|
Returns
| Type |
Description |
| Task<bool> |
|
View Source
ReplaceUserGroupPermissions(int, ISet<string>, params int[])
Replaces the same permission set for a single group to any number of entities
Declaration
void ReplaceUserGroupPermissions(int groupId, ISet<string> permissions, params int[] entityIds)
Parameters
| Type |
Name |
Description |
| int |
groupId |
Id of the group
|
| ISet<string> |
permissions |
Permissions as enumerable list of char,
if no permissions are specified then all permissions for this node are removed for this group
|
| int[] |
entityIds |
Specify the nodes to replace permissions for. If nothing is specified all permissions are
removed.
|
View Source
ResendInvitationAsync(Guid, UserResendInviteModel)
Declaration
Task<Attempt<UserInvitationResult, UserOperationStatus>> ResendInvitationAsync(Guid performingUserKey, UserResendInviteModel model)
Parameters
Returns
View Source
ResetPasswordAsync(Guid, Guid)
Declaration
Task<Attempt<PasswordChangedModel, UserOperationStatus>> ResetPasswordAsync(Guid performingUserKey, Guid userKey)
Parameters
| Type |
Name |
Description |
| Guid |
performingUserKey |
|
| Guid |
userKey |
|
Returns
View Source
ResetPasswordAsync(Guid, string, string)
Changes the user's password.
Declaration
Task<Attempt<PasswordChangedModel, UserOperationStatus>> ResetPasswordAsync(Guid userKey, string token, string password)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
The unique key of the user.
|
| string |
token |
The reset password token.
|
| string |
password |
The new password of the user.
|
Returns
View Source
SendResetPasswordEmailAsync(string)
Sends an email with a link to reset user's password.
Declaration
Task<Attempt<UserOperationStatus>> SendResetPasswordEmailAsync(string userEmail)
Parameters
| Type |
Name |
Description |
| string |
userEmail |
The email address of the user.
|
Returns
View Source
SetAvatarAsync(Guid, Guid)
Declaration
Task<UserOperationStatus> SetAvatarAsync(Guid userKey, Guid temporaryFileKey)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
|
| Guid |
temporaryFileKey |
|
Returns
View Source
UnlockAsync(Guid, params Guid[])
Declaration
Task<Attempt<UserUnlockResult, UserOperationStatus>> UnlockAsync(Guid performingUserKey, params Guid[] keys)
Parameters
| Type |
Name |
Description |
| Guid |
performingUserKey |
|
| Guid[] |
keys |
|
Returns
View Source
UpdateAsync(Guid, UserUpdateModel)
Declaration
Task<Attempt<IUser?, UserOperationStatus>> UpdateAsync(Guid performingUserKey, UserUpdateModel model)
Parameters
Returns
View Source
ValidateLoginSession(int, Guid)
Validates that a user login session is valid/current and hasn't been closed
Declaration
bool ValidateLoginSession(int userId, Guid sessionId)
Parameters
| Type |
Name |
Description |
| int |
userId |
|
| Guid |
sessionId |
|
Returns
View Source
VerifyInviteAsync(Guid, string)
Declaration
Task<Attempt<UserOperationStatus>> VerifyInviteAsync(Guid userKey, string token)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
|
| string |
token |
|
Returns
View Source
VerifyPasswordResetAsync(Guid, string)
Verifies the reset code sent from the reset password mail for a given user.
Declaration
Task<Attempt<UserOperationStatus>> VerifyPasswordResetAsync(Guid userKey, string token)
Parameters
| Type |
Name |
Description |
| Guid |
userKey |
The unique key of the user.
|
| string |
token |
The reset password token.
|
Returns