C# Класс Roadkill.Core.Security.FormsAuthUserService

Provides user management using the Roadkill datastore and the current repository.
Наследование: Roadkill.Core.Security.UserServiceBase
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ActivateUser ( string activationKey ) : bool

Activates the user with given activation key

AddUser ( string email, string username, string password, bool isAdmin, bool isEditor ) : bool

Adds a user to the system, and sets the User.IsActivated to true.

Authenticate ( string email, string password ) : bool

Authenticates the user with the specified email.

ChangePassword ( string email, string oldPassword, string newPassword ) : bool

Changes the password of the user with the given email, authenticating their password first..

ChangePassword ( string email, string newPassword ) : void

Changes the password of a user with the given email.

DeleteUser ( string email ) : bool

Deletes a user with the given email from the system.

FormsAuthUserService ( Roadkill.Core.Configuration.ApplicationSettings settings, IRepository repository ) : System
GetLoggedInUser ( string cookieValue ) : User

Gets the currently logged in user, based off the cookie or HttpContext user identity value set during authentication. The value for FormsAuthentication is the user's Guid id.

GetLoggedInUserName ( System.Web.HttpContextBase context ) : string

Gets the current username by decrypting the cookie. If FormsAuthentication is disabled or there is no logged in user, this returns an empty string.

GetUser ( string email, bool isActivated = null ) : User

Retrieves a full User object for the email address provided, or null if the user doesn't exist.

GetUserById ( System.Guid id, bool isActivated = null ) : User

Retrieves a full User object using the unique ID provided.

GetUserByResetKey ( string resetKey ) : User

Retrieves a full User object for a password reset request.

IsAdmin ( string cookieValue ) : bool

Determines whether the specified user with the given email is an admin.

IsEditor ( string cookieValue ) : bool

Determines whether the specified user with the given email is an editor.

ListAdmins ( ) : IEnumerable

Lists all admins in the system.

ListEditors ( ) : IEnumerable

Lists all editors in the system.

Logout ( ) : void

Signs the user out with (typically with FormsAuthentication).

ResetPassword ( string email ) : string

Resets the password for the user with the given email.

Signup ( UserViewModel model, System.Action completed ) : string

Creates a user in the system without setting the User.IsActivated, in other words for a user confirmation email.

ToggleAdmin ( string email ) : void

Adds or remove the user with the email address as an admin.

ToggleEditor ( string email ) : void

Adds or remove the user with the email address as an editor.

UpdateUser ( UserViewModel model ) : bool

Changes the username of a user to a new username.

UserExists ( string email ) : bool

Determines whether the user with the given email exists.

UserNameExists ( string username ) : bool

Determines whether the user with the given username exists.

Описание методов

ActivateUser() публичный Метод

Activates the user with given activation key
public ActivateUser ( string activationKey ) : bool
activationKey string The randomly generated activation key for the user.
Результат bool

AddUser() публичный Метод

Adds a user to the system, and sets the User.IsActivated to true.
An databaseerror occurred while adding the new user.
public AddUser ( string email, string username, string password, bool isAdmin, bool isEditor ) : bool
email string The email or username.
username string
password string The password.
isAdmin bool if set to true the user is added as an admin.
isEditor bool if set to true the user is added as an editor.
Результат bool

Authenticate() публичный Метод

Authenticates the user with the specified email.
An databaseerror occurred while authenticating the user.
public Authenticate ( string email, string password ) : bool
email string The email address or username of the user.
password string The password.
Результат bool

ChangePassword() публичный Метод

Changes the password of the user with the given email, authenticating their password first..
An databaseerror occurred while changing the password OR the new password is empty.
public ChangePassword ( string email, string oldPassword, string newPassword ) : bool
email string The email address or username of the user.
oldPassword string The old password.
newPassword string The new password to change to.
Результат bool

ChangePassword() публичный Метод

Changes the password of a user with the given email.
An databaseerror occurred while changing the password OR the password is empty.
public ChangePassword ( string email, string newPassword ) : void
email string The email address of the user.
newPassword string The new password.
Результат void

DeleteUser() публичный Метод

Deletes a user with the given email from the system.
An databaseerror occurred while deleting the user.
public DeleteUser ( string email ) : bool
email string The email address or username of the user.
Результат bool

FormsAuthUserService() публичный Метод

public FormsAuthUserService ( Roadkill.Core.Configuration.ApplicationSettings settings, IRepository repository ) : System
settings Roadkill.Core.Configuration.ApplicationSettings
repository IRepository
Результат System

GetLoggedInUser() публичный Метод

Gets the currently logged in user, based off the cookie or HttpContext user identity value set during authentication. The value for FormsAuthentication is the user's Guid id.
public GetLoggedInUser ( string cookieValue ) : User
cookieValue string The user id stored in the cookie.
Результат Roadkill.Core.Database.User

GetLoggedInUserName() публичный Метод

Gets the current username by decrypting the cookie. If FormsAuthentication is disabled or there is no logged in user, this returns an empty string.
public GetLoggedInUserName ( System.Web.HttpContextBase context ) : string
context System.Web.HttpContextBase
Результат string

GetUser() публичный Метод

Retrieves a full User object for the email address provided, or null if the user doesn't exist.
public GetUser ( string email, bool isActivated = null ) : User
email string The email address of the user to get
isActivated bool
Результат Roadkill.Core.Database.User

GetUserById() публичный Метод

Retrieves a full User object using the unique ID provided.
public GetUserById ( System.Guid id, bool isActivated = null ) : User
id System.Guid The ID of the user.
isActivated bool
Результат Roadkill.Core.Database.User

GetUserByResetKey() публичный Метод

Retrieves a full User object for a password reset request.
public GetUserByResetKey ( string resetKey ) : User
resetKey string
Результат Roadkill.Core.Database.User

IsAdmin() публичный Метод

Determines whether the specified user with the given email is an admin.
An databaseerror occurred while email/username.
public IsAdmin ( string cookieValue ) : bool
cookieValue string The user id or username of the user.
Результат bool

IsEditor() публичный Метод

Determines whether the specified user with the given email is an editor.
An databaseerror occurred while checking email/username.
public IsEditor ( string cookieValue ) : bool
cookieValue string The user id or username of the user.
Результат bool

ListAdmins() публичный Метод

Lists all admins in the system.
An databaseerror occurred while getting the admins.
public ListAdmins ( ) : IEnumerable
Результат IEnumerable

ListEditors() публичный Метод

Lists all editors in the system.
An databaseerror occurred while getting the editors.
public ListEditors ( ) : IEnumerable
Результат IEnumerable

Logout() публичный Метод

Signs the user out with (typically with FormsAuthentication).
public Logout ( ) : void
Результат void

ResetPassword() публичный Метод

Resets the password for the user with the given email.
public ResetPassword ( string email ) : string
email string The email address or username of the user.
Результат string

Signup() публичный Метод

Creates a user in the system without setting the User.IsActivated, in other words for a user confirmation email.
public Signup ( UserViewModel model, System.Action completed ) : string
model UserViewModel
completed System.Action Called once the signup (e.g. email is sent) is complete. Pass Null for no action.
Результат string

ToggleAdmin() публичный Метод

Adds or remove the user with the email address as an admin.
An databaseerror occurred while setting the user to an admin.
public ToggleAdmin ( string email ) : void
email string The email address or username of the user.
Результат void

ToggleEditor() публичный Метод

Adds or remove the user with the email address as an editor.
An databaseerror occurred while setting the user to an editor.
public ToggleEditor ( string email ) : void
email string The email address or username of the user.
Результат void

UpdateUser() публичный Метод

Changes the username of a user to a new username.
An databaseerror occurred while changing the email/username.
public UpdateUser ( UserViewModel model ) : bool
model UserViewModel The user details to change. The password property is ignored for this object - use ChangePassword instead.
Результат bool

UserExists() публичный Метод

Determines whether the user with the given email exists.
An databaseerror occurred while checking the email/user.
public UserExists ( string email ) : bool
email string The email address or username of the user.
Результат bool

UserNameExists() публичный Метод

Determines whether the user with the given username exists.
public UserNameExists ( string username ) : bool
username string
Результат bool