Yii Access Control Lists  0.8
Advanced and convenient Access Control
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
ACLObject Class Reference
Inheritance diagram for ACLObject:
ACLObjectCollection Aco Aro AcoCollection AroCollection

List of all members.

Public Member Functions

 straightSave ($runValidation=false, $attributes=NULL)
 save ($runValidation=false, $attributes=NULL)
 delete ()
 hasParent ()
 getParent ()
 translateActions ($actions)
 afterFind ()

Static Public Member Functions

static model ($className=__CLASS__)
static getAllActions ()

Public Attributes

 $parent_id = NULL
 $lft = NULL
 $rgt = NULL
 $isTree = true
 $strict = false

Static Public Attributes

static $habtmTable = '{{aco_aro}}'
static $aroTable = '{{aro}}'
static $acoTable = '{{aco}}'

Protected Member Functions

 loadObject ($identifier, $model=NULL)
 loadObjects ($identifier, $model=NULL, $onlyFirst=false)

Protected Attributes

 $old_parent_id = NULL
 $tree = NULL

Static Protected Attributes

static $reservedColumns = array('id', 'aro_id', 'aco_id', 'aro_lft', 'aro_rgt', 'aco_lft', 'aco_rgt')

Detailed Description

ACLObject Class File

Author:
zeroByte <dispyfree@googlemail.com>

Member Function Documentation

ACLObject::afterFind ( )

automagic: saves the parent_id to track parent-changes

See also:
ACLObject::straightSave
ACLObject::parent_id
ACLObject::old_parent_id
ACLObject::delete ( )

automatic: if the object is deleted, it's associated tree-rows need to be deleted too

Returns:
bool whether the deletion succeeded
static ACLObject::getAllActions ( ) [static]

Returns all possible actions on the Acos

See also:
ACLObject::reservedColumns
Returns:
array all available actions
ACLObject::getParent ( )

Returns the parent of the object if the object has no parent or if it isn't existent, an exception is thrown

Returns:
mixed the parent object
ACLObject::hasParent ( )

Checks whether the current object has got a parent

Returns:
bool true if it has a parent - otherwise false
ACLObject::loadObject ( identifier,
model = NULL 
) [protected]

This method is an equivalent of loadObjects

See also:
AclObject::loadObjects
Parameters:
mixed$identifierThe identifier denoting the object
mixed$modelthe model to load the object from
Returns:
mixed the object
ACLObject::loadObjects ( identifier,
model = NULL,
onlyFirst = false 
) [protected]

This method is used to load Objects (either Aco or Aro) using convenient identifiers. In particular this is used to load Aro-/Aco-Objects associated to a collection

Parameters:
mixed$identifierThe Identifier denoting the associated row in the ACL-system. Supported identifiers: 1) Array syntax: array('model' => 'MyModel', 'foreign_key' => myId) e.g.: model => User, foreign_key => the ID of the user (presumable AUTO_INCREMENT INT from the user row) 2) alias syntax: "MyAlias" e.g.: "Visitors", "Admins", "Authors" 3) direct syntax: pass your object derived from CActiveRecord directly e.g.: loadObject(User::model()->find(....)) This will be automatically resolved to the first syntax. Please be aware that the system does _not_ automatically create corresponding ACL-rows for the objects you pass in. So if you pass a new object which has no corresponding aco/aro-row, this will lead to an exception. 4) Of course, you can pass the finished object directly. As many methods call this method without check, this is natural.
mixed$modelThe model - this can be either an object of type CActiveRecord or a string which will be instantiated accordingly
boolean$onlyFirstDetermines whether to fetch only the first matching object, or all of them.
Returns:
type
static ACLObject::model ( className = __CLASS__) [static]

Returns the static model of the specified AR class.

Parameters:
string$classNameactive record class name.
Returns:
User the static model class

Reimplemented in ACLObjectCollection, AroCollection, Aro, AcoCollection, and Aco.

ACLObject::save ( runValidation = false,
attributes = NULL 
)

This automatic save-method will automatically update the underlying tree if crucial values (e.g.: parent) are changed

See also:
CActiveRecord::save
ACLObject::straightSave
Parameters:
bool$runValidationWhether to run the validation before saving the record
array$attributesadditional parameters (see Yii-doc)
Returns:
bool whether the save succeeded
ACLObject::straightSave ( runValidation = false,
attributes = NULL 
)

There are occasions where we must not call the regular, automatical save function. Especially the Tree-Object has to make direct changes to the lft- and rgt-values without invoking the automatic logic. Disgarding this method will lead to infinite recursion loops. In fact, this method is only a wrapper to CActiveRecord::save

See also:
ACLObject::save
Parameters:
bool$runValidationWhether to run the validation before saving the record
array$attributesadditional parameters (see Yii-doc)
Returns:
bool whether the save succeeded
ACLObject::translateActions ( actions)

Translates the given action-set to real actions.

Parameters:
mixed$actionsThe actions to be performed Currently supported syntax: 1) array('action1', 'action2'...) 2) wildcard "*" will fetch all actions
Returns:
array the actions available on a specific object

The documentation for this class was generated from the following file:
 All Classes Functions