Versions
Look up a class, method, property or event

CAuthItem

Package system.web.auth
Inheritance class CAuthItem » CComponent
Since 1.0
Version $Id: CAuthItem.php 971 2009-04-30 03:00:43Z qiang.xue $
CAuthItem represents an authorization item. An authorization item can be an operation, a task or a role. They form an authorization hierarchy. Items on higher levels of the hierarchy inherit the permissions represented by items on lower levels. A user may be assigned one or several authorization items (called assignments. He can perform an operation only when it is among his assigned items.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
authManager IAuthManager the authorization manager CAuthItem
bizRule string the business rule associated with this item CAuthItem
children array Returns the children of this item. CAuthItem
data string the additional data associated with this item CAuthItem
description string the item description CAuthItem
name string the item name CAuthItem
type integer the authorization item type. CAuthItem

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. CComponent
__construct() Constructor. CAuthItem
__get() Returns a property value, an event handler list or a behavior based on its name. CComponent
__isset() Checks if a property value is null. CComponent
__set() Sets value of a component property. CComponent
__unset() Sets a component property to be null. CComponent
addChild() Adds a child item. CAuthItem
asa() Returns the named behavior object. CComponent
assign() Assigns this item to a user. CAuthItem
attachBehavior() Attaches a behavior to this component. CComponent
attachBehaviors() Attaches a list of behaviors to the component. CComponent
attachEventHandler() Attaches an event handler to an event. CComponent
canGetProperty() Determines whether a property can be read. CComponent
canSetProperty() Determines whether a property can be set. CComponent
checkAccess() Checks to see if the specified item is within the hierarchy starting from this item. CAuthItem
detachBehavior() Detaches a behavior from the component. CComponent
detachBehaviors() Detaches all behaviors from the component. CComponent
detachEventHandler() Detaches an existing event handler. CComponent
disableBehavior() Disables an attached behavior. CComponent
disableBehaviors() Disables all behaviors attached to this component. CComponent
enableBehavior() Enables an attached behavior. CComponent
enableBehaviors() Enables all behaviors attached to this component. CComponent
getAssignment() Returns the item assignment information. CAuthItem
getAuthManager() CAuthItem
getBizRule() CAuthItem
getChildren() Returns the children of this item. CAuthItem
getData() CAuthItem
getDescription() CAuthItem
getEventHandlers() Returns the list of attached event handlers for an event. CComponent
getName() CAuthItem
getType() CAuthItem
hasChild() Returns a value indicating whether a child exists CAuthItem
hasEvent() Determines whether an event is defined. CComponent
hasEventHandler() Checks whether the named event has attached handlers. CComponent
hasProperty() Determines whether a property is defined. CComponent
isAssigned() Returns a value indicating whether this item has been assigned to the user. CAuthItem
raiseEvent() Raises an event. CComponent
removeChild() Removes a child item. CAuthItem
revoke() Revokes an authorization assignment from a user. CAuthItem
setBizRule() CAuthItem
setData() CAuthItem
setDescription() CAuthItem
setName() CAuthItem

Property Details

authManager property read-only

the authorization manager

bizRule property
public string getBizRule()
public void setBizRule(string $value)

the business rule associated with this item

children property read-only
public array getChildren()

Returns the children of this item.

data property
public string getData()
public void setData(string $value)

the additional data associated with this item

description property
public string getDescription()
public void setDescription(string $value)

the item description

name property
public string getName()
public void setName(string $value)

the item name

type property read-only
public integer getType()

the authorization item type. This could be 0 (operation), 1 (task) or 2 (role).

Method Details

__construct() method
public void __construct(IAuthManager $auth, string $name, integer $type, description $description='', string $bizRule=NULL, mixed $data=NULL)
$auth IAuthManager authorization manager
$name string authorization item name
$type integer authorization item type. This can be 0 (operation), 1 (task) or 2 (role).
$description description the description
$bizRule string the business rule associated with this item
$data mixed additional data for this item

Constructor.

addChild() method
public boolean addChild(string $name)
$name string the name of the child item
{return} boolean whether the item is added successfully

Adds a child item.

assign() method
public CAuthAssignment assign(mixed $userId, string $bizRule=NULL, mixed $data=NULL)
$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.

Assigns this item to a user.

checkAccess() method
public boolean checkAccess(string $itemName, array $params=array ( ))
$itemName string the name of the item to be checked
$params array the parameters to be passed to business rule evaluation
{return} boolean whether the specified item is within the hierarchy starting from this item.

Checks to see if the specified item is within the hierarchy starting from this item. This method is internally used by IAuthManager::checkAccess.

getAssignment() method
public CAuthAssignment getAssignment(mixed $userId)
$userId mixed the user ID (see IWebUser::getId)
{return} CAuthAssignment the item assignment information. Null is returned if this item is not assigned to the user.

Returns the item assignment information.

getAuthManager() method
public IAuthManager getAuthManager()
{return} IAuthManager the authorization manager

getBizRule() method
public string getBizRule()
{return} string the business rule associated with this item

getChildren() method
public array getChildren()
{return} array all child items of this item.

Returns the children of this item.

getData() method
public string getData()
{return} string the additional data associated with this item

getDescription() method
public string getDescription()
{return} string the item description

getName() method
public string getName()
{return} string the item name

getType() method
public integer getType()
{return} integer the authorization item type. This could be 0 (operation), 1 (task) or 2 (role).

hasChild() method
public boolean hasChild(string $name)
$name string the child item name
{return} boolean whether the child exists

Returns a value indicating whether a child exists

isAssigned() method
public boolean isAssigned(mixed $userId)
$userId mixed the user ID (see IWebUser::getId)
{return} boolean whether the item has been assigned to the user.

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

removeChild() method
public boolean removeChild(string $name)
$name string the child item name
{return} boolean whether the removal is successful

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

revoke() method
public boolean revoke(mixed $userId)
$userId mixed the user ID (see IWebUser::getId)
{return} boolean whether removal is successful

Revokes an authorization assignment from a user.

setBizRule() method
public void setBizRule(string $value)
$value string the business rule associated with this item

setData() method
public void setData(string $value)
$value string the business rule associated with this item

setDescription() method
public void setDescription(string $value)
$value string the item description

setName() method
public void setName(string $value)
$value string the item name

Be the first person to leave a comment

Please to leave your comment.