Class CDbAuthManager
CDbAuthManager represents an authorization manager that stores authorization information in database.
The database connection is specified by CDbAuthManager::$connectionID
. And the
database schema should be as described in "framework/web/auth/*.sql". You may
change the names of the three tables used to store the authorization data by
setting CDbAuthManager::$itemTable
, CDbAuthManager::$itemChildTable
and CDbAuthManager::$assignmentTable
.
- CComponent
- CApplicationComponent implements IApplicationComponent
- CAuthManager implements IAuthManager
- CDbAuthManager
Direct known subclasses
X2AuthManagerCopyright: 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/CDbAuthManager.php
public
|
|
public
boolean
|
#
checkAccess( string $itemName, mixed $userId, array $params = array() )
Performs access check for the specified user. |
protected
boolean
|
#
checkAccessRecursive( string $itemName, mixed $userId, array $params, array $assignments )
Performs access check for the specified user. This method is internally
called by |
public
boolean
|
|
public
boolean
|
#
removeItemChild( string $itemName, string $childName )
Removes a child from its parent. Note, the child item is not deleted. Only the parent-child relationship is removed. |
public
boolean
|
#
hasItemChild( string $itemName, string $childName )
Returns a value indicating whether a child exists within a parent. |
public
array
|
|
public
|
|
public
boolean
|
|
public
boolean
|
#
isAssigned( string $itemName, mixed $userId )
Returns a value indicating whether the item has been assigned to the user. |
public
|
|
public
array
|
|
public
|
#
saveAuthAssignment(
Saves the changes to an authorization assignment. |
public
array
|
#
getAuthItems( integer $type = null, mixed $userId = null )
Returns the authorization items of the specific type and user. |
public
|
#
createAuthItem( string $name, integer $type, string $description = '', string $bizRule = null, mixed $data = null )
Creates an authorization item. An authorization item represents an action permission (e.g. creating a post). It has three types: operation, task and role. Authorization items form a hierarchy. Higher level items inherit permissions representing by lower level items. |
public
boolean
|
|
public
|
|
public
|
#
saveAuthItem(
Saves an authorization item to persistent storage. |
public
|
|
public
|
|
public
|
|
protected
boolean
|
#
detectLoop( string $itemName, string $childName )
Checks whether there is a loop in the authorization item hierarchy. |
protected
|
|
protected
boolean
|
checkItemChildType(),
createOperation(),
createRole(),
createTask(),
executeBizRule(),
getOperations(),
getRoles(),
getTasks()
|
getIsInitialized()
|
public
string
|
$connectionID | 'db' |
#
the ID of the |
public
string
|
$itemTable | 'AuthItem' |
#
the name of the table storing authorization items. Defaults to 'AuthItem'. |
public
string
|
$itemChildTable | 'AuthItemChild' |
#
the name of the table storing authorization item hierarchy. Defaults to 'AuthItemChild'. |
public
string
|
$assignmentTable | 'AuthAssignment' |
#
the name of the table storing authorization item assignments. Defaults to 'AuthAssignment'. |
public
|
$db |
|
#
the database connection. By default, this is initialized automatically as the
application component whose ID is indicated as |
$defaultRoles,
$showErrors
|
$behaviors
|
public
array
|
$authItems |
#
The authorization items of the specific type. |
$operations,
$roles,
$tasks
|
$isInitialized
|