1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 10:12:41 +01:00

Update "bin/policy show" to use PolicyCodex

Summary: Fixes T12541. `describeAutomaticCapability()` is no longer required to implement `PolicyInterface`. Use PolicyCodex instead.

Test Plan: {F4889642}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12541

Differential Revision: https://secure.phabricator.com/D17658
This commit is contained in:
epriestley 2017-04-11 14:53:20 -07:00
parent 58a127f2f9
commit eeef60a678

View file

@ -65,16 +65,20 @@ final class PhabricatorPolicyManagementShowWorkflow
$console->writeOut(" %s\n",
PhabricatorPolicy::getPolicyExplanation($viewer, $policy->getPHID()));
$console->writeOut("\n");
$more = (array)$object->describeAutomaticCapability($capability);
if ($more) {
foreach ($more as $line) {
$console->writeOut(" %s\n", $line);
}
$console->writeOut("\n");
}
}
if ($object instanceof PhabricatorPolicyCodexInterface) {
$codex = PhabricatorPolicyCodex::newFromObject($object, $viewer);
$rules = $codex->getPolicySpecialRuleDescriptions();
foreach ($rules as $rule) {
echo tsprintf(
" - %s\n",
$rule->getDescription());
}
echo "\n";
}
}
}