@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.

Move the "Can Lock Projects" check from requireCapabilities() to transaction validation

Summary: Depends on D19584. Ref T13164. This check is an //extra// check: you need EDIT //and// this capability. Thus, we can do it in validation without issues.

Test Plan:
- This code isn't reachable today: all methods of applying this transaction do a separate check for "Can Lock" upfront.
- Commented out the "Can Lock" check in the LockController, tried to lock as a user without permission. Was rejected with a policy exception.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13164

Differential Revision: https://secure.phabricator.com/D19585

+18 -6
-6
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
··· 120 120 PhabricatorApplicationTransaction $xaction) { 121 121 122 122 switch ($xaction->getTransactionType()) { 123 - case PhabricatorProjectLockTransaction::TRANSACTIONTYPE: 124 - PhabricatorPolicyFilter::requireCapability( 125 - $this->requireActor(), 126 - newv($this->getEditorApplicationClass(), array()), 127 - ProjectCanLockProjectsCapability::CAPABILITY); 128 - return; 129 123 case PhabricatorTransactions::TYPE_EDGE: 130 124 switch ($xaction->getMetadataValue('edge:type')) { 131 125 case PhabricatorProjectProjectHasMemberEdgeType::EDGECONST:
+8
src/applications/project/xaction/PhabricatorProjectLockTransaction.php
··· 53 53 } 54 54 } 55 55 56 + public function validateTransactions($object, array $xactions) { 57 + if ($xactions) { 58 + $this->requireApplicationCapability( 59 + ProjectCanLockProjectsCapability::CAPABILITY); 60 + } 61 + return array(); 62 + } 63 + 56 64 }
+10
src/applications/transactions/storage/PhabricatorModularTransactionType.php
··· 356 356 return array(); 357 357 } 358 358 359 + protected function requireApplicationCapability($capability) { 360 + $application_class = $this->getEditor()->getEditorApplicationClass(); 361 + $application = newv($application_class, array()); 362 + 363 + PhabricatorPolicyFilter::requireCapability( 364 + $this->getActor(), 365 + $application, 366 + $capability); 367 + } 368 + 359 369 }