system system.base system.caching system.caching.dependencies system.collections system.console system.db system.db.ar system.db.schema system.db.schema.cubrid system.db.schema.mssql system.db.schema.mysql system.db.schema.oci system.db.schema.pgsql system.db.schema.sqlite system.gii system.i18n system.i18n.gettext system.logging system.test system.utils system.validators system.web system.web.actions system.web.auth system.web.filters system.web.form system.web.helpers system.web.renderers system.web.services system.web.widgets system.web.widgets.captcha system.web.widgets.pagers zii.behaviors zii.widgets zii.widgets.grid zii.widgets.jui

IAuthManager

system.base
继承 interface IAuthManager
子类 CAuthManager, CDbAuthManager, CPhpAuthManager
可用自 1.0
源码 framework/base/interfaces.php
IAuthManager interface is implemented by an auth manager application component.

An auth manager is mainly responsible for providing role-based access control (RBAC) service.

公共方法

隐藏继承的方法

方法描述被定义在
addItemChild() Adds an item as a child of another item. IAuthManager
assign() Assigns an authorization item to a user. IAuthManager
checkAccess() Performs access check for the specified user. IAuthManager
clearAll() Removes all authorization data. IAuthManager
clearAuthAssignments() Removes all authorization assignments. IAuthManager
createAuthItem() Creates an authorization item. IAuthManager
executeBizRule() Executes a business rule. IAuthManager
getAuthAssignment() Returns the item assignment information. IAuthManager
getAuthAssignments() Returns the item assignments for the specified user. IAuthManager
getAuthItem() Returns the authorization item with the specified name. IAuthManager
getAuthItems() Returns the authorization items of the specific type and user. IAuthManager
getItemChildren() Returns the children of the specified item. IAuthManager
hasItemChild() Returns a value indicating whether a child exists within a parent. IAuthManager
isAssigned() Returns a value indicating whether the item has been assigned to the user. IAuthManager
removeAuthItem() Removes the specified authorization item. IAuthManager
removeItemChild() Removes a child from its parent. IAuthManager
revoke() Revokes an authorization assignment from a user. IAuthManager
save() Saves authorization data into persistent storage. IAuthManager
saveAuthAssignment() Saves the changes to an authorization assignment. IAuthManager
saveAuthItem() Saves an authorization item to persistent storage. IAuthManager

方法详情

addItemChild() 方法
abstract public void addItemChild(string $itemName, string $childName)
$itemName string the parent item name
$childName string the child item name
源码: framework/base/interfaces.php#399 (显示)
public function addItemChild($itemName,$childName);

Adds an item as a child of another item.

assign() 方法
abstract public CAuthAssignment assign(string $itemName, mixed $userId, string $bizRule=NULL, mixed $data=NULL)
$itemName string the item name
$userId mixed the user ID (see IWebUser::getId)
$bizRule string the business rule to be executed when checkAccess is called for this particular authorization item.
$data mixed additional data associated with this assignment
{return} CAuthAssignment the authorization assignment information.
源码: framework/base/interfaces.php#433 (显示)
public function assign($itemName,$userId,$bizRule=null,$data=null);

Assigns an authorization item to a user.

checkAccess() 方法
abstract public boolean checkAccess(string $itemName, mixed $userId, array $params=array ( ))
$itemName string the name of the operation that we are checking access to
$userId mixed the user ID. This should be either an integer or a string representing the unique identifier of a user. See IWebUser::getId.
$params array name-value pairs that would be passed to biz rules associated with the tasks and roles assigned to the user.
{return} boolean whether the operations can be performed by the user.
源码: framework/base/interfaces.php#347 (显示)
public function checkAccess($itemName,$userId,$params=array());

Performs access check for the specified user.

clearAll() 方法
abstract public void clearAll()
源码: framework/base/interfaces.php#472 (显示)
public function clearAll();

Removes all authorization data.

clearAuthAssignments() 方法
abstract public void clearAuthAssignments()
源码: framework/base/interfaces.php#476 (显示)
public function clearAuthAssignments();

Removes all authorization assignments.

createAuthItem() 方法
abstract public CAuthItem createAuthItem(string $name, integer $type, string $description='', string $bizRule=NULL, mixed $data=NULL)
$name string the item name. This must be a unique identifier.
$type integer the item type (0: operation, 1: task, 2: role).
$description string description of the item
$bizRule string business rule associated with the item. This is a piece of PHP code that will be executed when checkAccess is called for the item.
$data mixed additional data associated with the item.
{return} CAuthItem the authorization item
源码: framework/base/interfaces.php#364 (显示)
public function createAuthItem($name,$type,$description='',$bizRule=null,$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.

executeBizRule() 方法
abstract public boolean executeBizRule(string $bizRule, array $params, mixed $data)
$bizRule string the business rule to be executed.
$params array additional parameters to be passed to the business rule when being executed.
$data mixed additional data that is associated with the corresponding authorization item or assignment
{return} boolean whether the execution returns a true value. If the business rule is empty, it will also return true.
源码: framework/base/interfaces.php#494 (显示)
public function executeBizRule($bizRule,$params,$data);

Executes a business rule. A business rule is a piece of PHP code that will be executed when checkAccess is called.

getAuthAssignment() 方法
abstract public CAuthAssignment getAuthAssignment(string $itemName, mixed $userId)
$itemName string the item name
$userId mixed the user ID (see IWebUser::getId)
{return} CAuthAssignment the item assignment information. Null is returned if the item is not assigned to the user.
源码: framework/base/interfaces.php#455 (显示)
public function getAuthAssignment($itemName,$userId);

Returns the item assignment information.

getAuthAssignments() 方法
abstract public array getAuthAssignments(mixed $userId)
$userId mixed the user ID (see IWebUser::getId)
{return} array the item assignment information for the user. An empty array will be returned if there is no item assigned to the user.
源码: framework/base/interfaces.php#462 (显示)
public function getAuthAssignments($userId);

Returns the item assignments for the specified user.

getAuthItem() 方法
abstract public CAuthItem getAuthItem(string $name)
$name string the name of the item
{return} CAuthItem the authorization item. Null if the item cannot be found.
源码: framework/base/interfaces.php#385 (显示)
public function getAuthItem($name);

Returns the authorization item with the specified name.

getAuthItems() 方法
abstract public array getAuthItems(integer $type=NULL, mixed $userId=NULL)
$type integer the item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type.
$userId mixed the user ID. Defaults to null, meaning returning all items even if they are not assigned to a user.
{return} array the authorization items of the specific type.
源码: framework/base/interfaces.php#379 (显示)
public function getAuthItems($type=null,$userId=null);

Returns the authorization items of the specific type and user.

getItemChildren() 方法
abstract public array getItemChildren(mixed $itemName)
$itemName mixed the parent item name. This can be either a string or an array. The latter represents a list of item names.
{return} array all child items of the parent
源码: framework/base/interfaces.php#421 (显示)
public function getItemChildren($itemName);

Returns the children of the specified item.

hasItemChild() 方法
abstract public boolean hasItemChild(string $itemName, string $childName)
$itemName string the parent item name
$childName string the child item name
{return} boolean whether the child exists
源码: framework/base/interfaces.php#414 (显示)
public function hasItemChild($itemName,$childName);

Returns a value indicating whether a child exists within a parent.

isAssigned() 方法
abstract public boolean isAssigned(string $itemName, mixed $userId)
$itemName string the item name
$userId mixed the user ID (see IWebUser::getId)
{return} boolean whether the item has been assigned to the user.
源码: framework/base/interfaces.php#447 (显示)
public function isAssigned($itemName,$userId);

Returns a value indicating whether the item has been assigned to the user.

removeAuthItem() 方法
abstract public boolean removeAuthItem(string $name)
$name string the name of the item to be removed
{return} boolean whether the item exists in the storage and has been removed
源码: framework/base/interfaces.php#370 (显示)
public function removeAuthItem($name);

Removes the specified authorization item.

removeItemChild() 方法
abstract public boolean removeItemChild(string $itemName, string $childName)
$itemName string the parent item name
$childName string the child item name
{return} boolean whether the removal is successful
源码: framework/base/interfaces.php#407 (显示)
public function removeItemChild($itemName,$childName);

Removes a child from its parent. Note, the child item is not deleted. Only the parent-child relationship is removed.

revoke() 方法
abstract public boolean revoke(string $itemName, mixed $userId)
$itemName string the item name
$userId mixed the user ID (see IWebUser::getId)
{return} boolean whether removal is successful
源码: framework/base/interfaces.php#440 (显示)
public function revoke($itemName,$userId);

Revokes an authorization assignment from a user.

save() 方法
abstract public void save()
源码: framework/base/interfaces.php#483 (显示)
public function save();

Saves authorization data into persistent storage. If any change is made to the authorization data, please make sure you call this method to save the changed data into persistent storage.

saveAuthAssignment() 方法
abstract public void saveAuthAssignment(CAuthAssignment $assignment)
$assignment CAuthAssignment the assignment that has been changed.
源码: framework/base/interfaces.php#467 (显示)
public function saveAuthAssignment($assignment);

Saves the changes to an authorization assignment.

saveAuthItem() 方法
abstract public void saveAuthItem(CAuthItem $item, string $oldName=NULL)
$item CAuthItem the item to be saved.
$oldName string the old item name. If null, it means the item name is not changed.
源码: framework/base/interfaces.php#391 (显示)
public function saveAuthItem($item,$oldName=null);

Saves an authorization item to persistent storage.