ACL Extension  0.3
 All Data Structures Namespaces Files Functions Variables
AclNode Class Reference
Inheritance diagram for AclNode:
PmAclNode PmAcoNode PmAroNode

Public Member Functions

 afterSave ()
 afterDelete ()
 branchNodeSubTree ($source, $destination)
 getDirectChildren ()
 getDirectParents ()
 __clone ()

Protected Member Functions

 removeFullRecursively ()
 takeOverPermissions ($node)
 takeOverSubTree (PmAclNode $node)
 generateDirectChildrenCondition ()
 generateDirectParentCondition ()

Detailed Description

Definition at line 11 of file AclNode.php.


Member Function Documentation

__clone ( )
abstract

Reimplemented in PmAclNode.

afterDelete ( )

Runs post-deletion errands

Definition at line 35 of file AclNode.php.

{
//First of all: delete all child-nodes and permissions
}
afterSave ( )

This will take over the permissions of another node belonging to the same AclObject, if the record is a new one

Definition at line 16 of file AclNode.php.

{
if($this->isNewRecord){
//First, find a random node of the same object
$node = $this::model()->find('collection_id = :col_id AND id != :id',
array(':col_id' => $this->collection_id, ':id' => $this->id));
//If there exists a node... otherwise we don't have to overtake anything
if($node !== NULL){
//Take over permissions of the the node
$this->takeOverPermissions($node);
$this->takeOverSubTree($node);
}
}
}
branchNodeSubTree (   $source,
  $destination 
)
abstract

Copies all children of $source recursively into $destination This branching is necessary because: If an AclObject is a child of another one, every AclNode of the parent object has to have one AclNode of the child AclObject as it's child (this is due to the lookup-mechanism this extension uses) If a new AclNode is created (for example because the parent object itself joins another object), the subtree of an existing node is copied to the new node

In fact "copied" is the wrong term, because each node isn't cloned but a surrogate is created which is in fact another object - but a node of the same AclObject having the same children as the original one.

public

Parameters:
AclNodesource
AclNodedestination
Returns:
int the number of branched nodes (recursive!)

Reimplemented in PmAclNode.

generateDirectChildrenCondition ( )
abstractprotected

Generates the condition matching the direct AclNodes of this node

Returns:
array(string, array) the first is the condition, the second one the params

Reimplemented in PmAclNode.

generateDirectParentCondition ( )
abstractprotected

Generates the condition matching the direct parent AclNodes of this node

Returns:
array(string, array) the first is the condition, the second one the params

Reimplemented in PmAclNode.

getDirectChildren ( )

Returns all the direct children of the given Node

public

Returns:
array[AclNode]

Definition at line 101 of file AclNode.php.

{
list($condition, $params) = $this->generateDirectChildrenCondition();
return $this->findAll($condition, $params);
}
getDirectParents ( )

Returns the direct parent AclNodes of this node

public

Parameters:
AclNodenode
Returns:
array[AclNode]

Definition at line 113 of file AclNode.php.

{
list($condition, $params) = $this->generateDirectParentCondition();
return $this->findAll($condition, $params);
}
removeFullRecursively ( )
abstractprotected

Removes all child-nodes and their associated permissions

Exceptions:
RuntimeException

Reimplemented in PmAclNode.

takeOverPermissions (   $node)
abstractprotected

This method copies all permissions assigned to another AclNode-Object of the same AclObject

Parameters:
AclNodethe node to take the permissions from

Reimplemented in PmAclNode.

takeOverSubTree ( PmAclNode  $node)
protected

Copies the subtree of the given other node of the same object to this new node

Parameters:
PmAclNode$nodethe node to take subtree from

Definition at line 60 of file AclNode.php.

{
$this->branchNodeSubTree($node, $this);
}

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