Phundament App Class Reference
  • Package
  • Class
  • Tree

Packages

  • bootstrap
    • widgets
      • input
  • Image
  • None
  • p3admin
  • p3extensions
    • behaviors
    • commands
    • components
    • helpers
    • widgets
  • p3media
    • actions
    • controllers
    • models
  • p3pages
    • models
  • p3widgets
    • components
    • models
  • PHP
  • system
    • db
      • ar
    • gii
    • web
      • auth
      • helpers
      • widgets
  • yiiext
    • widgets
      • fancybox
      • lipsum
  • zii
    • widgets
      • grid

Classes

  • WebUser

Class WebUser

CWebUser represents the persistent state for a Web application user.

CWebUser is used as an application component whose ID is 'user'. Therefore, at any place one can access the user state via Yii::app()->user.

CWebUser should be used together with an IUserIdentity identity which implements the actual authentication algorithm.

A typical authentication process using CWebUser is as follows:
  1. The user provides information needed for authentication.
  2. An IUserIdentity identity instance is created with the user-provided information.
  3. Call IUserIdentity::authenticate to check if the identity is valid.
  4. If valid, call CWebUser::login to login the user, and Redirect the user browser to returnUrl.
  5. If not valid, retrieve the error code or message from the identity instance and display it.

The property id and name are both identifiers for the user. The former is mainly used internally (e.g. primary key), while the latter is for display purpose (e.g. username). The id property is a unique identifier for a user that is persistent during the whole user session. It can be a username, or something else, depending on the implementation of the IUserIdentity identity class.

Both id and name are persistent during the user session. Besides, an identity may have additional persistent data which can be accessed by calling CWebUser::getState(). Note, when allowAutoLogin cookie-based authentication is enabled, all these persistent data will be stored in cookie. Therefore, do not store password or other sensitive data in the persistent storage. Instead, you should store them directly in session on the server side if needed.

CComponent
Extended by CApplicationComponent implements IApplicationComponent
Extended by CWebUser implements IWebUser
Extended by WebUser
Package: system\web\auth
Author: Qiang Xue <qiang.xue@gmail.com>
Version: $Id$
Since: 1.0
Located at mishamx/yii-user/components/WebUser.php

Methods summary

public
# getRole( )
public mixed
# getId( )

Returns a value that uniquely represents the user.

Returns a value that uniquely represents the user.

Returns

mixed
the unique identifier for the user. If null, it means the user is a guest.

Overrides

CWebUser::getId
protected
# afterLogin( boolean $fromCookie )

This method is called after the user is successfully logged in. You may override this method to do some postprocessing (e.g. log the user login IP and time; load the user permission information).

This method is called after the user is successfully logged in. You may override this method to do some postprocessing (e.g. log the user login IP and time; load the user permission information).

Parameters

$fromCookie
boolean
$fromCookie whether the login is based on cookie.

Since

1.1.3

Overrides

CWebUser::afterLogin
public
# updateSession( )
public
# model( mixed $id = 0 )
public
# user( mixed $id = 0 )
public
# getUserByName( mixed $username )
public
# getAdmins( )
public
# isAdmin( )

Methods inherited from CWebUser

__get(), __isset(), __set(), __unset(), afterLogout(), beforeLogin(), beforeLogout(), changeIdentity(), checkAccess(), clearStates(), createIdentityCookie(), getFlash(), getFlashes(), getIsGuest(), getName(), getReturnUrl(), getState(), getStateKeyPrefix(), hasFlash(), hasState(), init(), loadIdentityStates(), login(), loginRequired(), logout(), renewCookie(), restoreFromCookie(), saveIdentityStates(), saveToCookie(), setFlash(), setId(), setName(), setReturnUrl(), setState(), setStateKeyPrefix(), updateAuthStatus(), updateFlash()

Methods inherited from CApplicationComponent

getIsInitialized()

Methods inherited from CComponent

__call(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()

Magic methods summary

Constants summary

Constants inherited from CWebUser

AUTH_TIMEOUT_VAR, FLASH_COUNTERS, FLASH_KEY_PREFIX, STATES_VAR

Properties summary

public boolean $allowAutoLogin
#

whether to enable cookie-based login. Defaults to false.

whether to enable cookie-based login. Defaults to false.

public string|array $loginUrl
#

the URL for login. If using array, the first element should be the route to the login action, and the rest name-value pairs are GET parameters to construct the login URL (e.g. array('/site/login')). If this property is null, a 403 HTTP exception will be raised instead.

the URL for login. If using array, the first element should be the route to the login action, and the rest name-value pairs are GET parameters to construct the login URL (e.g. array('/site/login')). If this property is null, a 403 HTTP exception will be raised instead.

See

CController::createUrl

Properties inherited from CWebUser

$authTimeout, $autoRenewCookie, $autoUpdateFlash, $guestName, $identityCookie, $loginRequiredAjaxResponse

Properties inherited from CApplicationComponent

$behaviors

Magic properties inherited from CWebUser

$flashes, $id, $isGuest, $name, $returnUrl, $stateKeyPrefix

Magic properties inherited from CApplicationComponent

$isInitialized

Phundament App Class Reference API documentation generated by ApiGen 2.8.0