Changeset View
Changeset View
Standalone View
Standalone View
src/applications/policy/filter/PhabricatorPolicyFilter.php
Show First 20 Lines • Show All 911 Lines • ▼ Show 20 Lines | foreach ($objects as $key => $object) { | ||||
$application->getPolicy(PhabricatorPolicyCapability::CAN_VIEW), | $application->getPolicy(PhabricatorPolicyCapability::CAN_VIEW), | ||||
PhabricatorPolicyCapability::CAN_VIEW); | PhabricatorPolicyCapability::CAN_VIEW); | ||||
} | } | ||||
return $objects; | return $objects; | ||||
} | } | ||||
private function getApplicationForPHID($phid) { | private function getApplicationForPHID($phid) { | ||||
$phid_type = phid_get_type($phid); | static $class_map = array(); | ||||
$phid_type = phid_get_type($phid); | |||||
if (!isset($class_map[$phid_type])) { | |||||
$type_objects = PhabricatorPHIDType::getTypes(array($phid_type)); | $type_objects = PhabricatorPHIDType::getTypes(array($phid_type)); | ||||
$type_object = idx($type_objects, $phid_type); | $type_object = idx($type_objects, $phid_type); | ||||
if (!$type_object) { | if (!$type_object) { | ||||
$class = false; | |||||
} else { | |||||
$class = $type_object->getPHIDTypeApplicationClass(); | |||||
} | |||||
$class_map[$phid_type] = $class; | |||||
} | |||||
$class = $class_map[$phid_type]; | |||||
if ($class === false) { | |||||
return null; | return null; | ||||
} | } | ||||
return $type_object->getPHIDTypeApplicationClass(); | return $class; | ||||
} | } | ||||
} | } |