@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

Support Spaces in Passphrase

Summary: Ref T8493. This stuff mostly takes care of itself now.

Test Plan: Shifted stuff between spaces, verified transactions/headers showed up correctly. Queried by space.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: joshuaspence, epriestley

Maniphest Tasks: T8493

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

+26 -4
+2
resources/sql/autopatches/20150621.phrase.2.sql
··· 1 + ALTER TABLE {$NAMESPACE}_passphrase.passphrase_credential 2 + ADD spacePHID VARBINARY(64);
+1
src/__phutil_library_map__.php
··· 4781 4781 'PhabricatorApplicationTransactionInterface', 4782 4782 'PhabricatorPolicyInterface', 4783 4783 'PhabricatorDestructibleInterface', 4784 + 'PhabricatorSpacesInterface', 4784 4785 ), 4785 4786 'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule', 4786 4787 'PassphraseCredentialConduitController' => 'PassphraseController',
+9 -2
src/applications/passphrase/controller/PassphraseCredentialEditController.php
··· 60 60 $e_name = true; 61 61 62 62 $v_desc = $credential->getDescription(); 63 + $v_space = $credential->getSpacePHID(); 63 64 64 65 $v_username = $credential->getUsername(); 65 66 $e_username = true; ··· 93 94 $v_is_locked = $request->getStr('lock'); 94 95 95 96 $v_secret = $request->getStr('secret'); 97 + $v_space = $request->getStr('spacePHID'); 96 98 $v_password = $request->getStr('password'); 97 99 $v_decrypt = $v_secret; 98 100 ··· 127 129 $type_is_locked = PassphraseCredentialTransaction::TYPE_LOCK; 128 130 $type_view_policy = PhabricatorTransactions::TYPE_VIEW_POLICY; 129 131 $type_edit_policy = PhabricatorTransactions::TYPE_EDIT_POLICY; 132 + $type_space = PhabricatorTransactions::TYPE_SPACE; 130 133 131 134 $xactions = array(); 132 135 ··· 145 148 $xactions[] = id(new PassphraseCredentialTransaction()) 146 149 ->setTransactionType($type_edit_policy) 147 150 ->setNewValue($v_edit_policy); 151 + 152 + $xactions[] = id(new PassphraseCredentialTransaction()) 153 + ->setTransactionType($type_space) 154 + ->setNewValue($v_space); 148 155 149 156 // Open a transaction in case we're writing a new secret; this limits 150 157 // the amount of code which handles secret plaintexts. ··· 244 251 ->setValue($type->getCredentialTypeName())) 245 252 ->appendChild( 246 253 id(new AphrontFormDividerControl())) 247 - ->appendChild( 254 + ->appendControl( 248 255 id(new AphrontFormPolicyControl()) 249 256 ->setName('viewPolicy') 250 257 ->setPolicyObject($credential) 251 258 ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) 252 259 ->setPolicies($policies)) 253 - ->appendChild( 260 + ->appendControl( 254 261 id(new AphrontFormPolicyControl()) 255 262 ->setName('editPolicy') 256 263 ->setPolicyObject($credential)
+14 -2
src/applications/passphrase/storage/PassphraseCredential.php
··· 4 4 implements 5 5 PhabricatorApplicationTransactionInterface, 6 6 PhabricatorPolicyInterface, 7 - PhabricatorDestructibleInterface { 7 + PhabricatorDestructibleInterface, 8 + PhabricatorSpacesInterface { 8 9 9 10 protected $name; 10 11 protected $credentialType; ··· 18 19 protected $isLocked = 0; 19 20 protected $allowConduit = 0; 20 21 protected $authorPHID; 22 + protected $spacePHID; 21 23 22 24 private $secret = self::ATTACHABLE; 23 25 ··· 37 39 ->setIsDestroyed(0) 38 40 ->setAuthorPHID($actor->getPHID()) 39 41 ->setViewPolicy($view_policy) 40 - ->setEditPolicy($edit_policy); 42 + ->setEditPolicy($edit_policy) 43 + ->setSpacePHID($actor->getDefaultSpacePHID()); 41 44 } 42 45 43 46 public function getMonogram() { ··· 158 161 $this->delete(); 159 162 $this->saveTransaction(); 160 163 } 164 + 165 + 166 + /* -( PhabricatorSpacesInterface )----------------------------------------- */ 167 + 168 + 169 + public function getSpacePHID() { 170 + return $this->spacePHID; 171 + } 172 + 161 173 }