C# 클래스 Roadkill.Core.Security.FormsAuthUserService

Provides user management using the Roadkill datastore and the current repository.
상속: Roadkill.Core.Security.UserServiceBase
파일 보기 프로젝트 열기: LocalGovDigital/pipeline 1 사용 예제들

공개 메소드들

메소드 설명
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