PHP 클래스 Contao\User

The class supports user authentication, login and logout, persisting the session data and initializing the user object from a database row. It functions as abstract parent class for the "BackendUser" and "FrontendUser" classes of the core. Usage: $user = BackendUser::getInstance(); if ($user->findBy('username', 'leo')) { echo $user->name; }
상속: extends System
파일 보기 프로젝트 열기: contao/core-bundle 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$arrData array Data
$intId integer User ID
$objInstance User Object instance (Singleton)
$strCookie string Cookie name
$strHash string Authentication hash
$strIp string IP address
$strTable string Table

공개 메소드들

메소드 설명
__clone ( ) Prevent cloning of the object (Singleton)
__get ( string $strKey ) : mixed Return an object property
__isset ( string $strKey ) : boolean Check whether a property is set
__set ( string $strKey, mixed $varValue ) Set an object property
__toString ( ) : string Get a string representation of the user
authenticate ( ) : boolean Authenticate a user
findBy ( string $strColumn, mixed $varValue ) : boolean Find a user in the database
getData ( ) : array Return the current record as associative array
getInstance ( ) : static Instantiate a new user object (Factory)
getTable ( ) : string Return the table name
isMemberOf ( integer $id ) : boolean Return true if the user is member of a particular group
login ( ) : boolean Try to login the current user
logout ( ) : boolean Remove the authentication cookie and destroy the current session
save ( ) Update the current record

보호된 메소드들

메소드 설명
__construct ( ) Import the database object
checkAccountStatus ( ) : boolean Check the account status and return true if it is active
generateSession ( ) Generate a session
regenerateSessionId ( ) Regenerate the session ID
setUserFromDb ( ) Set all user properties from a database record

메소드 상세

__clone() 최종 공개 메소드

Prevent cloning of the object (Singleton)
final public __clone ( )

__construct() 보호된 메소드

Import the database object
protected __construct ( )

__get() 공개 메소드

Return an object property
public __get ( string $strKey ) : mixed
$strKey string The property name
리턴 mixed The property value

__isset() 공개 메소드

Check whether a property is set
public __isset ( string $strKey ) : boolean
$strKey string The property name
리턴 boolean True if the property is set

__set() 공개 메소드

Set an object property
public __set ( string $strKey, mixed $varValue )
$strKey string The property name
$varValue mixed The property value

__toString() 공개 메소드

Get a string representation of the user
public __toString ( ) : string
리턴 string The string representation

authenticate() 공개 메소드

Authenticate a user
public authenticate ( ) : boolean
리턴 boolean True if the user could be authenticated

checkAccountStatus() 보호된 메소드

Check the account status and return true if it is active
protected checkAccountStatus ( ) : boolean
리턴 boolean True if the account is active

findBy() 공개 메소드

Find a user in the database
public findBy ( string $strColumn, mixed $varValue ) : boolean
$strColumn string The field name
$varValue mixed The field value
리턴 boolean True if the user was found

generateSession() 보호된 메소드

Generate a session
protected generateSession ( )

getData() 공개 메소드

Return the current record as associative array
public getData ( ) : array
리턴 array

getInstance() 공개 정적인 메소드

Instantiate a new user object (Factory)
public static getInstance ( ) : static
리턴 static The object instance

getTable() 공개 메소드

Return the table name
public getTable ( ) : string
리턴 string

isMemberOf() 공개 메소드

Return true if the user is member of a particular group
public isMemberOf ( integer $id ) : boolean
$id integer The group ID
리턴 boolean True if the user is a member of the group

login() 공개 메소드

Try to login the current user
public login ( ) : boolean
리턴 boolean True if the user could be logged in

logout() 공개 메소드

Remove the authentication cookie and destroy the current session
public logout ( ) : boolean
리턴 boolean True if the user could be logged out

regenerateSessionId() 보호된 메소드

Regenerate the session ID
protected regenerateSessionId ( )

save() 공개 메소드

Update the current record
public save ( )

setUserFromDb() 추상적인 보호된 메소드

Set all user properties from a database record
abstract protected setUserFromDb ( )

프로퍼티 상세

$arrData 보호되어 있는 프로퍼티

Data
protected array $arrData
리턴 array

$intId 보호되어 있는 프로퍼티

User ID
protected int $intId
리턴 integer

$objInstance 보호되어 있는 정적으로 프로퍼티

Object instance (Singleton)
protected static User,contao $objInstance
리턴 User

$strCookie 보호되어 있는 프로퍼티

Cookie name
protected string $strCookie
리턴 string

$strHash 보호되어 있는 프로퍼티

Authentication hash
protected string $strHash
리턴 string

$strIp 보호되어 있는 프로퍼티

IP address
protected string $strIp
리턴 string

$strTable 보호되어 있는 프로퍼티

Table
protected string $strTable
리턴 string