Interface IUserService
Manage (get / update) user information
public interface IUserService
Methods
AddUserAsync(User)
Save a user to the Database. The User object contains all the information incl. what Site it belongs to.
Task<User> AddUserAsync(User user)
Parameters
userUser
Returns
- Task<User>
DeleteUserAsync(int, int)
Delete / remove a user in the database
Task DeleteUserAsync(int userId, int siteId)
Parameters
Returns
- Task
ForgotPasswordAsync(User)
Trigger a forgot-password e-mail for this User.
Task ForgotPasswordAsync(User user)
Parameters
userUser
Returns
- Task
GetPasswordRequirementsAsync(int)
Get password requirements for site
Task<string> GetPasswordRequirementsAsync(int siteId)
Parameters
siteIdintID of a Site
Returns
- Task<string>
GetPersonalAccessTokenAsync()
Get personal access token for current user (administrators only)
Task<string> GetPersonalAccessTokenAsync()
Returns
- Task<string>
GetTokenAsync()
Get token for current user
Task<string> GetTokenAsync()
Returns
- Task<string>
GetUserAsync(int, int)
Get a User of a specific site
Task<User> GetUserAsync(int userId, int siteId)
Parameters
Returns
- Task<User>
GetUserAsync(string, int)
Get a User of a specific site
Task<User> GetUserAsync(string username, int siteId)
Parameters
Returns
- Task<User>
GetUserAsync(string, string, int)
Get a User of a specific site
Task<User> GetUserAsync(string username, string email, int siteId)
Parameters
usernamestringUsername / login of a User
emailstringemail address of a User
siteIdintID of a Site
Returns
- Task<User>
ImportUsersAsync(int, int, bool)
Bulk import of users
Task<Dictionary<string, string>> ImportUsersAsync(int siteId, int fileId, bool notify)
Parameters
siteIdintID of a Site
fileIdintID of a File
notifyboolIndicates if new users should be notified by email
Returns
- Task<Dictionary<string, string>>
LinkUserAsync(User, string, string, string, string)
Link an external login with a local user account
Task<User> LinkUserAsync(User user, string token, string type, string key, string name)
Parameters
userUserThe User we're verifying
tokenstringA Hash value in the URL which verifies this user got the e-mail (containing this token)
typestringExternal Login provider type
keystringExternal Login provider key
namestringExternal Login provider display name
Returns
- Task<User>
LoginUserAsync(User, bool, bool)
Will login the specified User.
Note that this will probably not be a real User, but a user object where the Username and Password have been filled.
Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent)
Parameters
userUserA User object which should have at least the Username and Password set.
setCookieboolDetermines if the login cookie should be set (only relevant for Hybrid scenarios)
isPersistentboolDetermines if the login cookie should be persisted for a long time.
Returns
- Task<User>
LogoutUserAsync(User)
Logout a User
Task LogoutUserAsync(User user)
Parameters
userUser
Returns
- Task
LogoutUserEverywhereAsync(User)
Logout a User
Task LogoutUserEverywhereAsync(User user)
Parameters
userUser
Returns
- Task
ResetPasswordAsync(User, string)
Reset the password of this User
Task<User> ResetPasswordAsync(User user, string token)
Parameters
userUsertokenstring
Returns
- Task<User>
UpdateUserAsync(User)
Update an existing user in the database.
Task<User> UpdateUserAsync(User user)
Parameters
userUser
Returns
- Task<User>
ValidatePasswordAsync(string)
Validate a users password against the password policy
Task<bool> ValidatePasswordAsync(string password)
Parameters
passwordstring
Returns
- Task<bool>
ValidateUserAsync(string, string, string)
Validate identity user info.
Task<UserValidateResult> ValidateUserAsync(string username, string email, string password)
Parameters
usernamestringemailstringpasswordstring
Returns
- Task<UserValidateResult>
VerifyEmailAsync(User, string)
Update e-mail verification status of a user.
Task<User> VerifyEmailAsync(User user, string token)
Parameters
userUserThe User we're verifying
tokenstringA Hash value in the URL which verifies this user got the e-mail (containing this token)
Returns
- Task<User>
VerifyTwoFactorAsync(User, string)
Verify the two factor verification code User
Task<User> VerifyTwoFactorAsync(User user, string token)
Parameters
userUsertokenstring
Returns
- Task<User>