PHP Класс GxcUser, gxc-cms

Автор: Tuan Nguyen ([email protected])
Наследование: extends CWebUser
Показать файл Открыть проект

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

Метод Описание
afterLogin ( boolean $fromCookie ) Actions to be taken after logging in.
beforeLogin ( type $id, type $states, type $fromCookie ) : type Function to check from Before Login if it is from Cookie
checkAccess ( string $operation, array $params = [], boolean $allowCaching = true ) : boolean Performs access check for this user.
getIsSuperuser ( ) : boolean
getModel ( $attr = '' ) : Object Get the Model from the session of Current User
getRightsReturnUrl ( string $defaultUrl = null ) : string Returns the URL that the user should be redirected to after updating an authorization item.
getisAdmin ( ) This is a function that checks the field 'role' in the User model to be equal to 1, that means it's admin
login ( UserIndentity $identity, integer $duration = 3600 ) Login Function
logout ( boolean $destroySession = true ) Logout Function
setIsSuperuser ( boolean $value )
setRightsReturnUrl ( array $value )

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

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

Overloads the parent method in order to mark superusers.
public afterLogin ( boolean $fromCookie )
$fromCookie boolean whether the login is based on cookie.

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

Function to check from Before Login if it is from Cookie
public beforeLogin ( type $id, type $states, type $fromCookie ) : type
$id type
$states type
$fromCookie type
Результат type

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

Overloads the parent method in order to allow superusers access implicitly.
public checkAccess ( string $operation, array $params = [], boolean $allowCaching = true ) : boolean
$operation string the name of the operation that need access check.
$params array name-value pairs that would be passed to business rules associated with the tasks and roles assigned to the user.
$allowCaching boolean whether to allow caching the result of access checki. This parameter has been available since version 1.0.5. When this parameter is true (default), if the access check of an operation was performed before, its result will be directly returned when calling this method to check the same operation. If this parameter is false, this method will always call {@link CAuthManager::checkAccess} to obtain the up-to-date access result. Note that this caching is effective only within the same request.
Результат boolean whether the operations can be performed by this user.

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

public getIsSuperuser ( ) : boolean
Результат boolean whether the user is a superuser.

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

Get the Model from the session of Current User
public getModel ( $attr = '' ) : Object
Результат Object from Session of Current User

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

Returns the URL that the user should be redirected to after updating an authorization item.
public getRightsReturnUrl ( string $defaultUrl = null ) : string
$defaultUrl string the default return URL in case it was not set previously. If this is null, the application entry URL will be considered as the default return URL.
Результат string the URL that the user should be redirected to after updating an authorization item.

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

access it by Yii::app()->user->isAdmin()
public getisAdmin ( )

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

Login Function
public login ( UserIndentity $identity, integer $duration = 3600 )
$identity UserIndentity
$duration integer

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

Logout Function
public logout ( boolean $destroySession = true )
$destroySession boolean destroy the session or not

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

public setIsSuperuser ( boolean $value )
$value boolean whether the user is a superuser.

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

public setRightsReturnUrl ( array $value )
$value array return url.