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 |
|
System.String |
clientId |
|
Returns
View Source
AssignUserGroupPermission(Int32, String, Int32[])
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 |
System.Int32 |
groupId |
Id of the group
|
System.String |
permission |
|
System.Int32[] |
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(Int32)
Removes all valid sessions for the user
Declaration
int ClearLoginSessions(int userId)
Parameters
Type |
Name |
Description |
System.Int32 |
userId |
|
Returns
Type |
Description |
System.Int32 |
|
View Source
CreateAsync(Guid, UserCreateModel, Boolean)
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.
|
System.Boolean |
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 |
|
System.String |
token |
|
System.String |
password |
|
Returns
View Source
CreateLoginSession(Int32, 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 |
System.Int32 |
userId |
|
System.String |
requestingIpAddress |
|
Returns
View Source
Delete(IUser, Boolean)
Deletes or disables a User
Declaration
void Delete(IUser user, bool deletePermanently)
Parameters
Type |
Name |
Description |
IUser |
user |
IUser to delete
|
System.Boolean |
deletePermanently |
True to permanently delete the user, False to disable the user
|
View Source
DeleteAsync(Guid, Guid)
Declaration
virtual Task<UserOperationStatus> DeleteAsync(Guid performingUserKey, Guid key)
Parameters
Type |
Name |
Description |
Guid |
performingUserKey |
|
Guid |
key |
|
Returns
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
DeleteSectionFromAllUserGroups(String)
Removes a specific section from all user groups
Declaration
void DeleteSectionFromAllUserGroups(string sectionAlias)
Parameters
Type |
Name |
Description |
System.String |
sectionAlias |
Alias of the section to remove
|
View Source
DeleteUserGroup(IUserGroup)
Declaration
void DeleteUserGroup(IUserGroup userGroup)
Parameters
Type |
Name |
Description |
IUserGroup |
userGroup |
UserGroup to delete
|
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, Int32, Int32, UserOrder, Direction)
Declaration
virtual 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 |
System.String |
clientId |
|
Returns
Type |
Description |
Task<IUser> |
|
View Source
GetAll(Int64, Int32, out Int64, 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 |
System.Int64 |
pageIndex |
|
System.Int32 |
pageSize |
|
System.Int64 |
totalRecords |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
UserState[] |
userState |
|
System.String[] |
userGroups |
A filter to only include user that belong to these user groups
|
System.String |
filter |
|
Returns
Type |
Description |
IEnumerable<IUser> |
|
View Source
GetAll(Int64, Int32, out Int64, 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 |
System.Int64 |
pageIndex |
|
System.Int32 |
pageSize |
|
System.Int64 |
totalRecords |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
UserState[] |
userState |
|
System.String[] |
includeUserGroups |
A filter to only include user that belong to these user groups
|
System.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, Int32, Int32)
Gets all users that the requesting user is allowed to see.
Declaration
virtual 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.
|
System.Int32 |
skip |
Amount to skip.
|
System.Int32 |
take |
Amount to take.
|
Returns
View Source
GetAllInGroup(Nullable<Int32>)
Gets a list of IUser objects associated with a given group
Declaration
IEnumerable<IUser> GetAllInGroup(int? groupId)
Parameters
Type |
Name |
Description |
System.Nullable<System.Int32> |
groupId |
Id of group
|
Returns
Type |
Description |
IEnumerable<IUser> |
|
View Source
GetAllNotInGroup(Int32)
Gets a list of IUser objects not associated with a given group
Declaration
IEnumerable<IUser> GetAllNotInGroup(int groupId)
Parameters
Type |
Name |
Description |
System.Int32 |
groupId |
Id of group
|
Returns
Type |
Description |
IEnumerable<IUser> |
|
View Source
GetAllUserGroups(Int32[])
Gets all UserGroups or those specified as parameters
Declaration
IEnumerable<IUserGroup> GetAllUserGroups(params int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
Optional Ids of UserGroups to retrieve
|
Returns
View Source
GetAsync(Guid)
Declaration
virtual 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
GetAsync(IEnumerable<Guid>)
Declaration
virtual Task<IEnumerable<IUser>> GetAsync(IEnumerable<Guid> keys)
Parameters
Type |
Name |
Description |
IEnumerable<Guid> |
keys |
|
Returns
Type |
Description |
Task<IEnumerable<IUser>> |
|
View Source
GetClientIdsAsync(Guid)
Declaration
Task<IEnumerable<string>> GetClientIdsAsync(Guid userKey)
Parameters
Type |
Name |
Description |
Guid |
userKey |
|
Returns
Type |
Description |
Task<IEnumerable<System.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, Int32[])
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
|
System.Int32[] |
nodeIds |
Specifying nothing will return all user permissions for all nodes that have explicit permissions
defined
|
Returns
View Source
GetPermissions(IUserGroup[], Boolean, Int32[])
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 |
|
System.Boolean |
fallbackToDefaultPermissions |
Flag indicating if we want to include the default group permissions for each result if there are not explicit
permissions set
|
System.Int32[] |
nodeIds |
Specifying nothing will return all permissions for all nodes
|
Returns
View Source
GetPermissionsAsync(Guid, 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
|
System.String |
path |
Path to check permissions for
|
Returns
View Source
GetPermissionsForPath(IUserGroup[], String, Boolean)
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 |
|
System.String |
path |
Path to check permissions for
|
System.Boolean |
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(Int32)
Gets an IProfile by User Id.
Declaration
IProfile GetProfileById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
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 |
System.String |
username |
Username
|
Returns
View Source
GetUserById(Int32)
Declaration
IUser GetUserById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Id of the user to retrieve
|
Returns
View Source
GetUserGroupByAlias(String)
Gets a UserGroup by its Alias
Declaration
IUserGroup GetUserGroupByAlias(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
Name of the UserGroup to retrieve
|
Returns
View Source
GetUserGroupById(Int32)
Gets a UserGroup by its Id
Declaration
IUserGroup GetUserGroupById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Id of the UserGroup to retrieve
|
Returns
View Source
GetUserGroupsByAlias(String[])
Gets a UserGroup by its Alias
Declaration
IEnumerable<IUserGroup> GetUserGroupsByAlias(params string[] alias)
Parameters
Type |
Name |
Description |
System.String[] |
alias |
Alias of the UserGroup to retrieve
|
Returns
View Source
GetUsersById(Int32[])
Declaration
IEnumerable<IUser> GetUsersById(params int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
Ids of the users to retrieve
|
Returns
View Source
GetUserStates()
This is basically facets of UserStates key = state, value = count
Declaration
IDictionary<UserState, int> GetUserStates()
Returns
Type |
Description |
IDictionary<UserState, System.Int32> |
|
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 |
|
System.String |
clientId |
|
Returns
Type |
Description |
Task<System.Boolean> |
|
View Source
ReplaceUserGroupPermissions(Int32, ISet<String>, Int32[])
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 |
System.Int32 |
groupId |
Id of the group
|
ISet<System.String> |
permissions |
Permissions as enumerable list of System.Char,
if no permissions are specified then all permissions for this node are removed for this group
|
System.Int32[] |
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.
|
System.String |
token |
The reset password token.
|
System.String |
password |
The new password of the user.
|
Returns
View Source
Save(IUserGroup, Int32[])
Declaration
void Save(IUserGroup userGroup, int[] userIds = null)
Parameters
Type |
Name |
Description |
IUserGroup |
userGroup |
UserGroup to save
|
System.Int32[] |
userIds |
If null than no changes are made to the users who are assigned to this group, however if a value is passed in
than all users will be removed from this group and only these users will be added
|
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 |
System.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, 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(Int32, 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 |
System.Int32 |
userId |
|
Guid |
sessionId |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
VerifyInviteAsync(Guid, String)
Declaration
Task<Attempt<UserOperationStatus>> VerifyInviteAsync(Guid userKey, string token)
Parameters
Type |
Name |
Description |
Guid |
userKey |
|
System.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.
|
System.String |
token |
The reset password token.
|
Returns