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
DeleteUserAsync(int, int)
Delete / remove a user in the database
Task DeleteUserAsync(int userId, int siteId)
Parameters
Returns
ForgotPasswordAsync(User)
Trigger a forgot-password e-mail for this User.
Task ForgotPasswordAsync(User user)
Parameters
user
User
Returns
GetPasswordRequirementsAsync(int)
Get password requirements for site
Task<string> GetPasswordRequirementsAsync(int siteId)
Parameters
Returns
GetPersonalAccessTokenAsync()
Get personal access token for current user (administrators only)
Task<string> GetPersonalAccessTokenAsync()
Returns
GetTokenAsync()
Get token for current user
Task<string> GetTokenAsync()
Returns
GetUserAsync(int, int)
Get a User of a specific site
Task<User> GetUserAsync(int userId, int siteId)
Parameters
Returns
GetUserAsync(string, int)
Get a User of a specific site
Task<User> GetUserAsync(string username, int siteId)
Parameters
Returns
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
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
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
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
LogoutUserAsync(User)
Logout a User
Task LogoutUserAsync(User user)
Parameters
user
User
Returns
LogoutUserEverywhereAsync(User)
Logout a User
Task LogoutUserEverywhereAsync(User user)
Parameters
user
User
Returns
ResetPasswordAsync(User, string)
Reset the password of this User
Task<User> ResetPasswordAsync(User user, string token)
Parameters
Returns
UpdateUserAsync(User)
Update an existing user in the database.
Task<User> UpdateUserAsync(User user)
Parameters
user
User
Returns
ValidatePasswordAsync(string)
Validate a users password against the password policy
Task<bool> ValidatePasswordAsync(string password)
Parameters
password
string
Returns
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
VerifyTwoFactorAsync(User, string)
Verify the two factor verification code User
Task<User> VerifyTwoFactorAsync(User user, string token)