PHP 클래스 Nette\Security\User

상속: extends Nette\Object
파일 보기 프로젝트 열기: nette/security 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$authenticatedRole default role for authenticated user without own identity
$guestRole default role for unauthenticated user
$onLoggedIn function (User $sender); Occurs when the user is successfully logged in
$onLoggedOut function (User $sender); Occurs when the user is logged out

공개 메소드들

메소드 설명
__construct ( Nette\Security\IUserStorage $storage, Nette\Security\IAuthenticator $authenticator = NULL, Nette\Security\IAuthorizator $authorizator = NULL )
getAuthenticator ( $need = TRUE ) : Nette\Security\IAuthenticator Returns authentication handler.
getAuthorizator ( $need = TRUE ) : Nette\Security\IAuthorizator Returns current authorization handler.
getId ( ) : mixed Returns current user ID, if any.
getIdentity ( ) : Nette\Security\IIdentity | null Returns current user identity, if any.
getLogoutReason ( ) : integer Why was user logged out?
getRoles ( ) : array Returns a list of effective roles that a user has been granted.
getStorage ( ) : Nette\Security\IUserStorage
isAllowed ( $resource = IAuthorizator::ALL, $privilege = IAuthorizator::ALL ) : boolean Has a user effective access to the Resource? If $resource is NULL, then the query applies to all resources.
isInRole ( $role ) : boolean Is a user in the specified effective role?
isLoggedIn ( ) : boolean Is this user authenticated?
login ( $id = NULL, $password = NULL ) : void Conducts the authentication process. Parameters are optional.
logout ( $clearIdentity = FALSE ) : void Logs out the user from the current session.
setAuthenticator ( Nette\Security\IAuthenticator $handler ) : self Sets authentication handler.
setAuthorizator ( Nette\Security\IAuthorizator $handler ) : self Sets authorization handler.
setExpiration ( $time, $whenBrowserIsClosed = TRUE, $clearIdentity = FALSE ) : self Enables log out after inactivity.

메소드 상세

__construct() 공개 메소드

public __construct ( Nette\Security\IUserStorage $storage, Nette\Security\IAuthenticator $authenticator = NULL, Nette\Security\IAuthorizator $authorizator = NULL )
$storage Nette\Security\IUserStorage
$authenticator Nette\Security\IAuthenticator
$authorizator Nette\Security\IAuthorizator

getAuthenticator() 공개 메소드

Returns authentication handler.
public getAuthenticator ( $need = TRUE ) : Nette\Security\IAuthenticator
리턴 Nette\Security\IAuthenticator

getAuthorizator() 공개 메소드

Returns current authorization handler.
public getAuthorizator ( $need = TRUE ) : Nette\Security\IAuthorizator
리턴 Nette\Security\IAuthorizator

getId() 공개 메소드

Returns current user ID, if any.
public getId ( ) : mixed
리턴 mixed

getIdentity() 공개 메소드

Returns current user identity, if any.
public getIdentity ( ) : Nette\Security\IIdentity | null
리턴 Nette\Security\IIdentity | null

getLogoutReason() 공개 메소드

Why was user logged out?
public getLogoutReason ( ) : integer
리턴 integer

getRoles() 공개 메소드

Returns a list of effective roles that a user has been granted.
public getRoles ( ) : array
리턴 array

getStorage() 공개 메소드

public getStorage ( ) : Nette\Security\IUserStorage
리턴 Nette\Security\IUserStorage

isAllowed() 공개 메소드

Has a user effective access to the Resource? If $resource is NULL, then the query applies to all resources.
public isAllowed ( $resource = IAuthorizator::ALL, $privilege = IAuthorizator::ALL ) : boolean
리턴 boolean

isInRole() 공개 메소드

Is a user in the specified effective role?
public isInRole ( $role ) : boolean
리턴 boolean

isLoggedIn() 공개 메소드

Is this user authenticated?
public isLoggedIn ( ) : boolean
리턴 boolean

login() 공개 메소드

Conducts the authentication process. Parameters are optional.
public login ( $id = NULL, $password = NULL ) : void
리턴 void

logout() 공개 메소드

Logs out the user from the current session.
public logout ( $clearIdentity = FALSE ) : void
리턴 void

setAuthenticator() 공개 메소드

Sets authentication handler.
public setAuthenticator ( Nette\Security\IAuthenticator $handler ) : self
$handler Nette\Security\IAuthenticator
리턴 self

setAuthorizator() 공개 메소드

Sets authorization handler.
public setAuthorizator ( Nette\Security\IAuthorizator $handler ) : self
$handler Nette\Security\IAuthorizator
리턴 self

setExpiration() 공개 메소드

Enables log out after inactivity.
public setExpiration ( $time, $whenBrowserIsClosed = TRUE, $clearIdentity = FALSE ) : self
리턴 self

프로퍼티 상세

$authenticatedRole 공개적으로 프로퍼티

default role for authenticated user without own identity
public $authenticatedRole

$guestRole 공개적으로 프로퍼티

default role for unauthenticated user
public $guestRole

$onLoggedIn 공개적으로 프로퍼티

function (User $sender); Occurs when the user is successfully logged in
public $onLoggedIn

$onLoggedOut 공개적으로 프로퍼티

function (User $sender); Occurs when the user is logged out
public $onLoggedOut