Allow "Default View" policies to be set to Public

Summary: Ref T603. Currently, we hard-code defense against setting policies to "Public" in several places, and special case only the CAN_VIEW policy. In fact, other policies (like Default View) should also be able to be set to public. Instead of hard-coding this, move it to the capability definitions.

Test Plan: Set default view policy in Maniphest to "Public", created a task, verified default policy.

Reviewers: btrahan, asherkin

Reviewed By: asherkin

CC: asherkin, aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D7276
This commit is contained in:
epriestley
2013-10-09 15:06:18 -07:00
parent 11fbd213b1
commit f4582dc49d
7 changed files with 36 additions and 10 deletions

View File

@@ -51,9 +51,9 @@ final class PhabricatorApplicationEditController
continue;
}
if ($new == PhabricatorPolicies::POLICY_PUBLIC &&
$capability != PhabricatorPolicyCapability::CAN_VIEW) {
// Can't set policies other than "view" to public.
$capobj = PhabricatorPolicyCapability::getCapabilityByKey($capability);
if (!$capobj || !$capobj->shouldAllowPublicPolicySetting()) {
// Can't set non-public policies to public.
continue;
}