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
user
User
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
user
User
Returns
- Task
GetPasswordRequirementsAsync(int)
Get password requirements for site
Task<string> GetPasswordRequirementsAsync(int siteId)
Parameters
siteId
intID 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
username
stringUsername / login of a User
email
stringemail address of a User
siteId
intID 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
siteId
intID of a Site
fileId
intID of a File
notify
boolIndicates 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
user
UserThe User we're verifying
token
stringA Hash value in the URL which verifies this user got the e-mail (containing this token)
type
stringExternal Login provider type
key
stringExternal Login provider key
name
stringExternal 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
user
UserA User object which should have at least the Username and Password set.
setCookie
boolDetermines if the login cookie should be set (only relevant for Hybrid scenarios)
isPersistent
boolDetermines if the login cookie should be persisted for a long time.
Returns
- Task<User>
LogoutUserAsync(User)
Logout a User
Task LogoutUserAsync(User user)
Parameters
user
User
Returns
- Task
LogoutUserEverywhereAsync(User)
Logout a User
Task LogoutUserEverywhereAsync(User user)
Parameters
user
User
Returns
- Task
ResetPasswordAsync(User, string)
Reset the password of this User
Task<User> ResetPasswordAsync(User user, string token)
Parameters
user
Usertoken
string
Returns
- Task<User>
UpdateUserAsync(User)
Update an existing user in the database.
Task<User> UpdateUserAsync(User user)
Parameters
user
User
Returns
- Task<User>
ValidatePasswordAsync(string)
Validate a users password against the password policy
Task<bool> ValidatePasswordAsync(string password)
Parameters
password
string
Returns
- Task<bool>
ValidateUserAsync(string, string, string)
Validate identity user info.
Task<UserValidateResult> ValidateUserAsync(string username, string email, string password)
Parameters
username
stringemail
stringpassword
string
Returns
- Task<UserValidateResult>
VerifyEmailAsync(User, string)
Update e-mail verification status of a user.
Task<User> VerifyEmailAsync(User user, string token)
Parameters
user
UserThe User we're verifying
token
stringA 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
user
Usertoken
string
Returns
- Task<User>