Remove empty implementations of describeAutomaticCapabilities()
Summary: This has been replaced by `PolicyCodex` after D16830. Also: - Rebuild Celerity map to fix grumpy unit test. - Fix one issue on the policy exception workflow to accommodate the new code. Test Plan: - `arc unit --everything` - Viewed policy explanations. - Viewed policy errors. Reviewers: chad Reviewed By: chad Subscribers: hach-que, PHID-OPKG-gm6ozazyms6q6i22gyam Differential Revision: https://secure.phabricator.com/D16831
This commit is contained in:
@@ -262,47 +262,16 @@ final class PhabricatorPolicyExplainController
|
||||
$capability) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
if ($object instanceof PhabricatorPolicyCodexInterface) {
|
||||
$codex = PhabricatorPolicyCodex::newFromObject($object, $viewer);
|
||||
$rules = $codex->getPolicySpecialRuleDescriptions();
|
||||
|
||||
$exceptions = array();
|
||||
foreach ($rules as $rule) {
|
||||
$is_active = $rule->getIsActive();
|
||||
if ($is_active) {
|
||||
$rule_capabilities = $rule->getCapabilities();
|
||||
if ($rule_capabilities) {
|
||||
if (!in_array($capability, $rule_capabilities)) {
|
||||
$is_active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$description = $rule->getDescription();
|
||||
|
||||
if (!$is_active) {
|
||||
$description = phutil_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => 'phui-policy-section-view-inactive-rule',
|
||||
),
|
||||
$description);
|
||||
}
|
||||
|
||||
$exceptions[] = $description;
|
||||
}
|
||||
} else if (method_exists($object, 'describeAutomaticCapability')) {
|
||||
$exceptions = (array)$object->describeAutomaticCapability($capability);
|
||||
$exceptions = array_filter($exceptions);
|
||||
} else {
|
||||
$exceptions = array();
|
||||
}
|
||||
$exceptions = PhabricatorPolicy::getSpecialRules(
|
||||
$object,
|
||||
$viewer,
|
||||
$capability,
|
||||
false);
|
||||
|
||||
if (!$exceptions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return id(new PHUIPolicySectionView())
|
||||
->setViewer($viewer)
|
||||
->setIcon('fa-unlock-alt red')
|
||||
|
||||
Reference in New Issue
Block a user