protected function getACLRuleFor($area, $oldAreas = array())
{
// If it's a ¬ation return the callback result
if (substr($area, 0, 1) == '&') {
$method = substr($area, 1);
// Method not found? Assume true.
if (!method_exists($this, $method)) {
return true;
}
return $this->{$method}();
}
// If it's not an @notation return the raw string
if (substr($area, 0, 1) != '@') {
return $area;
}
// Get the array index (other task)
$index = substr($area, 1);
// If the referenced task has no ACL map, return true
if (!isset($this->taskPrivileges[$index])) {
return true;
}
// Get the new ACL area
$newArea = $this->taskPrivileges[$index];
$oldAreas[] = $area;
// Circular reference found
if (in_array($newArea, $oldAreas)) {
return true;
}
// We've found an ACL privilege. Return it.
if (substr($area, 0, 1) != '@') {
return $newArea;
}
// We have another reference. Resolve it.
return $this->getACLRuleFor($newArea, $oldAreas);
}