mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-21 11:09:02 +01:00
Add a "template" parameter to application default policies
Summary: Ref T5681. Ref T6860. This doesn't do anything interesting on its own, just makes the next diff smaller. In the next diff, policies become aware of the types of objects they're acting on. We need to specify which object type all the "Default View/Edit" settings are for so they get the right rules. For example, a rule like "Allow task author" is OK for "View Policy" on a task, and also OK for "Default View Policy" on ManiphestApplication. But it's not OK for "Can Create Tasks" on ManiphestApplication. So annotate all the "template"/"default" policies with their types. The next diff will use these to let you select appropriate rules for the given object type. Test Plan: - Used `grep` to find these. - This change has no effect. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5681, T6860 Differential Revision: https://secure.phabricator.com/D13251
This commit is contained in:
parent
643b90008f
commit
52f8756c3c
15 changed files with 47 additions and 13 deletions
|
@ -582,6 +582,11 @@ abstract class PhabricatorApplication implements PhabricatorPolicyInterface {
|
|||
}
|
||||
}
|
||||
|
||||
public function getCapabilityTemplatePHIDType($capability) {
|
||||
$spec = $this->getCustomCapabilitySpecification($capability);
|
||||
return idx($spec, 'template');
|
||||
}
|
||||
|
||||
public function getApplicationSearchDocumentTypes() {
|
||||
return array();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ final class PhabricatorCountdownApplication extends PhabricatorApplication {
|
|||
return array(
|
||||
PhabricatorCountdownDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for new countdowns.'),
|
||||
'template' => PhabricatorCountdownCountdownPHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -186,6 +186,7 @@ final class PhabricatorDifferentialApplication extends PhabricatorApplication {
|
|||
return array(
|
||||
DifferentialDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for newly created revisions.'),
|
||||
'template' => DifferentialRevisionPHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -140,11 +140,16 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
|
|||
|
||||
protected function getCustomCapabilities() {
|
||||
return array(
|
||||
DiffusionDefaultViewCapability::CAPABILITY => array(),
|
||||
DiffusionDefaultViewCapability::CAPABILITY => array(
|
||||
'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
||||
),
|
||||
DiffusionDefaultEditCapability::CAPABILITY => array(
|
||||
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
||||
'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
||||
),
|
||||
DiffusionDefaultPushCapability::CAPABILITY => array(
|
||||
'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
||||
),
|
||||
DiffusionDefaultPushCapability::CAPABILITY => array(),
|
||||
DiffusionCreateRepositoriesCapability::CAPABILITY => array(
|
||||
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
||||
),
|
||||
|
|
|
@ -72,9 +72,12 @@ final class PhabricatorDrydockApplication extends PhabricatorApplication {
|
|||
|
||||
protected function getCustomCapabilities() {
|
||||
return array(
|
||||
DrydockDefaultViewCapability::CAPABILITY => array(),
|
||||
DrydockDefaultViewCapability::CAPABILITY => array(
|
||||
'template' => DrydockBlueprintPHIDType::TYPECONST,
|
||||
),
|
||||
DrydockDefaultEditCapability::CAPABILITY => array(
|
||||
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
||||
'template' => DrydockBlueprintPHIDType::TYPECONST,
|
||||
),
|
||||
DrydockCreateBlueprintsCapability::CAPABILITY => array(
|
||||
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
||||
|
|
|
@ -60,6 +60,7 @@ final class PhabricatorFilesApplication extends PhabricatorApplication {
|
|||
return array(
|
||||
FilesDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for newly created files.'),
|
||||
'template' => PhabricatorFileFilePHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ final class PhabricatorFundApplication extends PhabricatorApplication {
|
|||
return array(
|
||||
FundDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for newly created initiatives.'),
|
||||
'tempate' => FundInitiativePHIDType::TYPECONST,
|
||||
),
|
||||
FundCreateInitiativesCapability::CAPABILITY => array(
|
||||
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
||||
|
|
|
@ -75,8 +75,12 @@ final class PhabricatorLegalpadApplication extends PhabricatorApplication {
|
|||
protected function getCustomCapabilities() {
|
||||
return array(
|
||||
LegalpadCreateDocumentsCapability::CAPABILITY => array(),
|
||||
LegalpadDefaultViewCapability::CAPABILITY => array(),
|
||||
LegalpadDefaultEditCapability::CAPABILITY => array(),
|
||||
LegalpadDefaultViewCapability::CAPABILITY => array(
|
||||
'template' => PhabricatorLegalpadDocumentPHIDType::TYPECONST,
|
||||
),
|
||||
LegalpadDefaultEditCapability::CAPABILITY => array(
|
||||
'template' => PhabricatorLegalpadDocumentPHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,9 +131,11 @@ final class PhabricatorManiphestApplication extends PhabricatorApplication {
|
|||
return array(
|
||||
ManiphestDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for newly created tasks.'),
|
||||
'template' => ManiphestTaskPHIDType::TYPECONST,
|
||||
),
|
||||
ManiphestDefaultEditCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default edit policy for newly created tasks.'),
|
||||
'template' => ManiphestTaskPHIDType::TYPECONST,
|
||||
),
|
||||
ManiphestEditStatusCapability::CAPABILITY => array(),
|
||||
ManiphestEditAssignCapability::CAPABILITY => array(),
|
||||
|
|
|
@ -72,9 +72,11 @@ final class PhabricatorNuanceApplication extends PhabricatorApplication {
|
|||
return array(
|
||||
NuanceSourceDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for newly created sources.'),
|
||||
'template' => NuanceSourcePHIDType::TYPECONST,
|
||||
),
|
||||
NuanceSourceDefaultEditCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default edit policy for newly created sources.'),
|
||||
'template' => NuanceSourcePHIDType::TYPECONST,
|
||||
),
|
||||
NuanceSourceManageCapability::CAPABILITY => array(),
|
||||
);
|
||||
|
|
|
@ -64,9 +64,11 @@ final class PhabricatorPasteApplication extends PhabricatorApplication {
|
|||
return array(
|
||||
PasteDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for newly created pastes.'),
|
||||
'template' => PhabricatorPastePastePHIDType::TYPECONST,
|
||||
),
|
||||
PasteDefaultEditCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default edit policy for newly created pastes.'),
|
||||
'template' => PhabricatorPastePastePHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -71,8 +71,12 @@ final class PhabricatorPholioApplication extends PhabricatorApplication {
|
|||
|
||||
protected function getCustomCapabilities() {
|
||||
return array(
|
||||
PholioDefaultViewCapability::CAPABILITY => array(),
|
||||
PholioDefaultEditCapability::CAPABILITY => array(),
|
||||
PholioDefaultViewCapability::CAPABILITY => array(
|
||||
'template' => PholioMockPHIDType::TYPECONST,
|
||||
),
|
||||
PholioDefaultEditCapability::CAPABILITY => array(
|
||||
'template' => PholioMockPHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -119,16 +119,16 @@ final class PhabricatorProjectApplication extends PhabricatorApplication {
|
|||
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
||||
),
|
||||
ProjectDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht(
|
||||
'Default view policy for newly created projects.'),
|
||||
'caption' => pht('Default view policy for newly created projects.'),
|
||||
'template' => PhabricatorProjectProjectPHIDType::TYPECONST,
|
||||
),
|
||||
ProjectDefaultEditCapability::CAPABILITY => array(
|
||||
'caption' => pht(
|
||||
'Default edit policy for newly created projects.'),
|
||||
'caption' => pht('Default edit policy for newly created projects.'),
|
||||
'template' => PhabricatorProjectProjectPHIDType::TYPECONST,
|
||||
),
|
||||
ProjectDefaultJoinCapability::CAPABILITY => array(
|
||||
'caption' => pht(
|
||||
'Default join policy for newly created projects.'),
|
||||
'caption' => pht('Default join policy for newly created projects.'),
|
||||
'template' => PhabricatorProjectProjectPHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ final class PhabricatorSlowvoteApplication extends PhabricatorApplication {
|
|||
return array(
|
||||
PhabricatorSlowvoteDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for new polls.'),
|
||||
'template' => PhabricatorSlowvotePollPHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -73,10 +73,12 @@ final class PhabricatorSpacesApplication extends PhabricatorApplication {
|
|||
),
|
||||
PhabricatorSpacesCapabilityDefaultView::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for newly created spaces.'),
|
||||
'template' => PhabricatorSpacesNamespacePHIDType::TYPECONST,
|
||||
),
|
||||
PhabricatorSpacesCapabilityDefaultEdit::CAPABILITY => array(
|
||||
'caption' => pht('Default edit policy for newly created spaces.'),
|
||||
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
||||
'template' => PhabricatorSpacesNamespacePHIDType::TYPECONST,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue