PHP Class GxcUser, gxc-cms

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

Méthodes publiques

Méthode 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 méthode

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

beforeLogin() public méthode

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
Résultat type

checkAccess() public méthode

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

getIsSuperuser() public méthode

public getIsSuperuser ( ) : boolean
Résultat boolean whether the user is a superuser.

getModel() public méthode

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

getRightsReturnUrl() public méthode

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

getisAdmin() public méthode

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

login() public méthode

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

logout() public méthode

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

setIsSuperuser() public méthode

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

setRightsReturnUrl() public méthode

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