PHP Class GxcUser, gxc-cms

Author: Tuan Nguyen ([email protected])
Inheritance: extends CWebUser
Mostrar archivo Open project: nganhtuan63/gxc-cms

Public Methods

Method Description
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 )

Method Details

afterLogin() public method

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

beforeLogin() public method

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
return type

checkAccess() public method

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.
return boolean whether the operations can be performed by this user.

getIsSuperuser() public method

public getIsSuperuser ( ) : boolean
return boolean whether the user is a superuser.

getModel() public method

Get the Model from the session of Current User
public getModel ( $attr = '' ) : Object
return Object from Session of Current User

getRightsReturnUrl() public method

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.
return string the URL that the user should be redirected to after updating an authorization item.

getisAdmin() public method

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

login() public method

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

logout() public method

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

setIsSuperuser() public method

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

setRightsReturnUrl() public method

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