@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+47 -13
+5
src/applications/base/PhabricatorApplication.php
··· 582 582 } 583 583 } 584 584 585 + public function getCapabilityTemplatePHIDType($capability) { 586 + $spec = $this->getCustomCapabilitySpecification($capability); 587 + return idx($spec, 'template'); 588 + } 589 + 585 590 public function getApplicationSearchDocumentTypes() { 586 591 return array(); 587 592 }
+1
src/applications/countdown/application/PhabricatorCountdownApplication.php
··· 52 52 return array( 53 53 PhabricatorCountdownDefaultViewCapability::CAPABILITY => array( 54 54 'caption' => pht('Default view policy for new countdowns.'), 55 + 'template' => PhabricatorCountdownCountdownPHIDType::TYPECONST, 55 56 ), 56 57 ); 57 58 }
+1
src/applications/differential/application/PhabricatorDifferentialApplication.php
··· 186 186 return array( 187 187 DifferentialDefaultViewCapability::CAPABILITY => array( 188 188 'caption' => pht('Default view policy for newly created revisions.'), 189 + 'template' => DifferentialRevisionPHIDType::TYPECONST, 189 190 ), 190 191 ); 191 192 }
+7 -2
src/applications/diffusion/application/PhabricatorDiffusionApplication.php
··· 140 140 141 141 protected function getCustomCapabilities() { 142 142 return array( 143 - DiffusionDefaultViewCapability::CAPABILITY => array(), 143 + DiffusionDefaultViewCapability::CAPABILITY => array( 144 + 'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST, 145 + ), 144 146 DiffusionDefaultEditCapability::CAPABILITY => array( 145 147 'default' => PhabricatorPolicies::POLICY_ADMIN, 148 + 'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST, 146 149 ), 147 - DiffusionDefaultPushCapability::CAPABILITY => array(), 150 + DiffusionDefaultPushCapability::CAPABILITY => array( 151 + 'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST, 152 + ), 148 153 DiffusionCreateRepositoriesCapability::CAPABILITY => array( 149 154 'default' => PhabricatorPolicies::POLICY_ADMIN, 150 155 ),
+4 -1
src/applications/drydock/application/PhabricatorDrydockApplication.php
··· 72 72 73 73 protected function getCustomCapabilities() { 74 74 return array( 75 - DrydockDefaultViewCapability::CAPABILITY => array(), 75 + DrydockDefaultViewCapability::CAPABILITY => array( 76 + 'template' => DrydockBlueprintPHIDType::TYPECONST, 77 + ), 76 78 DrydockDefaultEditCapability::CAPABILITY => array( 77 79 'default' => PhabricatorPolicies::POLICY_ADMIN, 80 + 'template' => DrydockBlueprintPHIDType::TYPECONST, 78 81 ), 79 82 DrydockCreateBlueprintsCapability::CAPABILITY => array( 80 83 'default' => PhabricatorPolicies::POLICY_ADMIN,
+1
src/applications/files/application/PhabricatorFilesApplication.php
··· 60 60 return array( 61 61 FilesDefaultViewCapability::CAPABILITY => array( 62 62 'caption' => pht('Default view policy for newly created files.'), 63 + 'template' => PhabricatorFileFilePHIDType::TYPECONST, 63 64 ), 64 65 ); 65 66 }
+1
src/applications/fund/application/PhabricatorFundApplication.php
··· 55 55 return array( 56 56 FundDefaultViewCapability::CAPABILITY => array( 57 57 'caption' => pht('Default view policy for newly created initiatives.'), 58 + 'tempate' => FundInitiativePHIDType::TYPECONST, 58 59 ), 59 60 FundCreateInitiativesCapability::CAPABILITY => array( 60 61 'default' => PhabricatorPolicies::POLICY_ADMIN,
+6 -2
src/applications/legalpad/application/PhabricatorLegalpadApplication.php
··· 75 75 protected function getCustomCapabilities() { 76 76 return array( 77 77 LegalpadCreateDocumentsCapability::CAPABILITY => array(), 78 - LegalpadDefaultViewCapability::CAPABILITY => array(), 79 - LegalpadDefaultEditCapability::CAPABILITY => array(), 78 + LegalpadDefaultViewCapability::CAPABILITY => array( 79 + 'template' => PhabricatorLegalpadDocumentPHIDType::TYPECONST, 80 + ), 81 + LegalpadDefaultEditCapability::CAPABILITY => array( 82 + 'template' => PhabricatorLegalpadDocumentPHIDType::TYPECONST, 83 + ), 80 84 ); 81 85 } 82 86
+2
src/applications/maniphest/application/PhabricatorManiphestApplication.php
··· 131 131 return array( 132 132 ManiphestDefaultViewCapability::CAPABILITY => array( 133 133 'caption' => pht('Default view policy for newly created tasks.'), 134 + 'template' => ManiphestTaskPHIDType::TYPECONST, 134 135 ), 135 136 ManiphestDefaultEditCapability::CAPABILITY => array( 136 137 'caption' => pht('Default edit policy for newly created tasks.'), 138 + 'template' => ManiphestTaskPHIDType::TYPECONST, 137 139 ), 138 140 ManiphestEditStatusCapability::CAPABILITY => array(), 139 141 ManiphestEditAssignCapability::CAPABILITY => array(),
+2
src/applications/nuance/application/PhabricatorNuanceApplication.php
··· 72 72 return array( 73 73 NuanceSourceDefaultViewCapability::CAPABILITY => array( 74 74 'caption' => pht('Default view policy for newly created sources.'), 75 + 'template' => NuanceSourcePHIDType::TYPECONST, 75 76 ), 76 77 NuanceSourceDefaultEditCapability::CAPABILITY => array( 77 78 'caption' => pht('Default edit policy for newly created sources.'), 79 + 'template' => NuanceSourcePHIDType::TYPECONST, 78 80 ), 79 81 NuanceSourceManageCapability::CAPABILITY => array(), 80 82 );
+2
src/applications/paste/application/PhabricatorPasteApplication.php
··· 64 64 return array( 65 65 PasteDefaultViewCapability::CAPABILITY => array( 66 66 'caption' => pht('Default view policy for newly created pastes.'), 67 + 'template' => PhabricatorPastePastePHIDType::TYPECONST, 67 68 ), 68 69 PasteDefaultEditCapability::CAPABILITY => array( 69 70 'caption' => pht('Default edit policy for newly created pastes.'), 71 + 'template' => PhabricatorPastePastePHIDType::TYPECONST, 70 72 ), 71 73 ); 72 74 }
+6 -2
src/applications/pholio/application/PhabricatorPholioApplication.php
··· 71 71 72 72 protected function getCustomCapabilities() { 73 73 return array( 74 - PholioDefaultViewCapability::CAPABILITY => array(), 75 - PholioDefaultEditCapability::CAPABILITY => array(), 74 + PholioDefaultViewCapability::CAPABILITY => array( 75 + 'template' => PholioMockPHIDType::TYPECONST, 76 + ), 77 + PholioDefaultEditCapability::CAPABILITY => array( 78 + 'template' => PholioMockPHIDType::TYPECONST, 79 + ), 76 80 ); 77 81 } 78 82
+6 -6
src/applications/project/application/PhabricatorProjectApplication.php
··· 119 119 'default' => PhabricatorPolicies::POLICY_ADMIN, 120 120 ), 121 121 ProjectDefaultViewCapability::CAPABILITY => array( 122 - 'caption' => pht( 123 - 'Default view policy for newly created projects.'), 122 + 'caption' => pht('Default view policy for newly created projects.'), 123 + 'template' => PhabricatorProjectProjectPHIDType::TYPECONST, 124 124 ), 125 125 ProjectDefaultEditCapability::CAPABILITY => array( 126 - 'caption' => pht( 127 - 'Default edit policy for newly created projects.'), 126 + 'caption' => pht('Default edit policy for newly created projects.'), 127 + 'template' => PhabricatorProjectProjectPHIDType::TYPECONST, 128 128 ), 129 129 ProjectDefaultJoinCapability::CAPABILITY => array( 130 - 'caption' => pht( 131 - 'Default join policy for newly created projects.'), 130 + 'caption' => pht('Default join policy for newly created projects.'), 131 + 'template' => PhabricatorProjectProjectPHIDType::TYPECONST, 132 132 ), 133 133 ); 134 134 }
+1
src/applications/slowvote/application/PhabricatorSlowvoteApplication.php
··· 64 64 return array( 65 65 PhabricatorSlowvoteDefaultViewCapability::CAPABILITY => array( 66 66 'caption' => pht('Default view policy for new polls.'), 67 + 'template' => PhabricatorSlowvotePollPHIDType::TYPECONST, 67 68 ), 68 69 ); 69 70 }
+2
src/applications/spaces/application/PhabricatorSpacesApplication.php
··· 73 73 ), 74 74 PhabricatorSpacesCapabilityDefaultView::CAPABILITY => array( 75 75 'caption' => pht('Default view policy for newly created spaces.'), 76 + 'template' => PhabricatorSpacesNamespacePHIDType::TYPECONST, 76 77 ), 77 78 PhabricatorSpacesCapabilityDefaultEdit::CAPABILITY => array( 78 79 'caption' => pht('Default edit policy for newly created spaces.'), 79 80 'default' => PhabricatorPolicies::POLICY_ADMIN, 81 + 'template' => PhabricatorSpacesNamespacePHIDType::TYPECONST, 80 82 ), 81 83 ); 82 84 }