Class CAuthManager
CAuthManager is the base class for authorization manager classes.
CAuthManager extends CApplicationComponent
and implements some
methods that are common among authorization manager classes.
CAuthManager together with its concrete child classes implement the Role-Based Access Control (RBAC).
The main idea is that permissions are organized as a hierarchy of CAuthItem authorization items. Items on higher level inherit the permissions represented by items on lower level. And roles are simply top-level authorization items that may be assigned to individual users. A user is said to have a permission to do something if the corresponding authorization item is inherited by one of his roles.
Using authorization manager consists of two aspects. First, the authorization
hierarchy and assignments have to be established. CAuthManager and its child
classes provides APIs to accomplish this task. Developers may need to develop
some GUI so that it is more intuitive to end-users. Second, developers call
IAuthManager::checkAccess()
at appropriate places in the application code
to check if the current user has the needed permission for an operation.
- CComponent
- CApplicationComponent implements IApplicationComponent
- CAuthManager implements IAuthManager
Indirect known subclasses
X2AuthManagerPackage: system\web\auth
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/auth/CAuthManager.php
public
|
#
createRole( string $name, string $description = '', string $bizRule = null, mixed $data = null )
Creates a role. This is a shortcut method to |
public
|
#
createTask( string $name, string $description = '', string $bizRule = null, mixed $data = null )
Creates a task. This is a shortcut method to |
public
|
#
createOperation( string $name, string $description = '', string $bizRule = null, mixed $data = null )
Creates an operation. This is a shortcut method to |
public
array
|
#
getRoles( mixed $userId = null )
Returns roles. This is a shortcut method to |
public
array
|
#
getTasks( mixed $userId = null )
Returns tasks. This is a shortcut method to |
public
array
|
#
getOperations( mixed $userId = null )
Returns operations. This is a shortcut method to |
public
boolean
|
#
executeBizRule( string $bizRule, array $params, mixed $data )
Executes the specified business rule. |
protected
|
#
checkItemChildType( integer $parentType, integer $childType )
Checks the item types to make sure a child can be added to a parent. |
getIsInitialized(),
init()
|
public
boolean
|
$showErrors | false |
#
Enable error reporting for bizRules. |
public
array
|
$defaultRoles | array() |
#
list of role names that are assigned to all users implicitly. These roles do
not need to be explicitly assigned to any user. When calling |
$behaviors
|
public
array
|
$roles |
#
Roles (name=>CAuthItem). |
public
array
|
$tasks |
#
Tasks (name=>CAuthItem). |
public
array
|
$operations |
#
Operations (name=>CAuthItem). |
$isInitialized
|