Differential D20805 Diff 49609 src/applications/policy/controller/PhabricatorPolicyExplainController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/policy/controller/PhabricatorPolicyExplainController.php
Show First 20 Lines • Show All 312 Lines • ▼ Show 20 Lines | private function buildObjectSection( | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$capability_name = $this->getCapabilityName($capability); | $capability_name = $this->getCapabilityName($capability); | ||||
$object_section = id(new PHUIPolicySectionView()) | $object_section = id(new PHUIPolicySectionView()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setIcon($handle->getIcon().' bluegrey') | ->setIcon($handle->getIcon().' bluegrey') | ||||
->setHeader(pht('Object Policy')) | ->setHeader(pht('Object Policy')) | ||||
->appendList( | ->appendParagraph( | ||||
array( | array( | ||||
array( | array( | ||||
phutil_tag('strong', array(), pht('%s:', $capability_name)), | phutil_tag('strong', array(), pht('%s:', $capability_name)), | ||||
' ', | ' ', | ||||
$policy->getShortName(), | $policy->getShortName(), | ||||
), | ), | ||||
)) | )) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'In detail, this means that these users can take this action, '. | 'In detail, this means that these users can take this action, '. | ||||
'provided they pass all of the checks described above first:')) | 'provided they pass all of the checks described above first:')) | ||||
->appendList( | ->appendList( | ||||
array( | array( | ||||
PhabricatorPolicy::getPolicyExplanation( | PhabricatorPolicy::getPolicyExplanation( | ||||
$viewer, | $viewer, | ||||
$policy->getPHID()), | $policy->getPHID()), | ||||
)); | )); | ||||
if ($policy->isCustomPolicy()) { | |||||
$rules_view = id(new PhabricatorPolicyRulesView()) | |||||
->setViewer($viewer) | |||||
->setPolicy($policy); | |||||
$object_section->appendRulesView($rules_view); | |||||
} | |||||
$strength = $this->getStrengthInformation($object, $policy, $capability); | $strength = $this->getStrengthInformation($object, $policy, $capability); | ||||
if ($strength) { | if ($strength) { | ||||
$object_section->appendHint($strength); | $object_section->appendHint($strength); | ||||
} | } | ||||
return $object_section; | return $object_section; | ||||
} | } | ||||
} | } |