mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-01 19:22:42 +01:00
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
This commit is contained in:
parent
85af4b01b9
commit
e6b7f655ee
4 changed files with 26 additions and 4 deletions
2
resources/sql/autopatches/20150621.phrase.2.sql
Normal file
2
resources/sql/autopatches/20150621.phrase.2.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_passphrase.passphrase_credential
|
||||||
|
ADD spacePHID VARBINARY(64);
|
|
@ -4781,6 +4781,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorApplicationTransactionInterface',
|
'PhabricatorApplicationTransactionInterface',
|
||||||
'PhabricatorPolicyInterface',
|
'PhabricatorPolicyInterface',
|
||||||
'PhabricatorDestructibleInterface',
|
'PhabricatorDestructibleInterface',
|
||||||
|
'PhabricatorSpacesInterface',
|
||||||
),
|
),
|
||||||
'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule',
|
'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule',
|
||||||
'PassphraseCredentialConduitController' => 'PassphraseController',
|
'PassphraseCredentialConduitController' => 'PassphraseController',
|
||||||
|
|
|
@ -60,6 +60,7 @@ final class PassphraseCredentialEditController extends PassphraseController {
|
||||||
$e_name = true;
|
$e_name = true;
|
||||||
|
|
||||||
$v_desc = $credential->getDescription();
|
$v_desc = $credential->getDescription();
|
||||||
|
$v_space = $credential->getSpacePHID();
|
||||||
|
|
||||||
$v_username = $credential->getUsername();
|
$v_username = $credential->getUsername();
|
||||||
$e_username = true;
|
$e_username = true;
|
||||||
|
@ -93,6 +94,7 @@ final class PassphraseCredentialEditController extends PassphraseController {
|
||||||
$v_is_locked = $request->getStr('lock');
|
$v_is_locked = $request->getStr('lock');
|
||||||
|
|
||||||
$v_secret = $request->getStr('secret');
|
$v_secret = $request->getStr('secret');
|
||||||
|
$v_space = $request->getStr('spacePHID');
|
||||||
$v_password = $request->getStr('password');
|
$v_password = $request->getStr('password');
|
||||||
$v_decrypt = $v_secret;
|
$v_decrypt = $v_secret;
|
||||||
|
|
||||||
|
@ -127,6 +129,7 @@ final class PassphraseCredentialEditController extends PassphraseController {
|
||||||
$type_is_locked = PassphraseCredentialTransaction::TYPE_LOCK;
|
$type_is_locked = PassphraseCredentialTransaction::TYPE_LOCK;
|
||||||
$type_view_policy = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
$type_view_policy = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||||
$type_edit_policy = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
$type_edit_policy = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
||||||
|
$type_space = PhabricatorTransactions::TYPE_SPACE;
|
||||||
|
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
|
|
||||||
|
@ -146,6 +149,10 @@ final class PassphraseCredentialEditController extends PassphraseController {
|
||||||
->setTransactionType($type_edit_policy)
|
->setTransactionType($type_edit_policy)
|
||||||
->setNewValue($v_edit_policy);
|
->setNewValue($v_edit_policy);
|
||||||
|
|
||||||
|
$xactions[] = id(new PassphraseCredentialTransaction())
|
||||||
|
->setTransactionType($type_space)
|
||||||
|
->setNewValue($v_space);
|
||||||
|
|
||||||
// Open a transaction in case we're writing a new secret; this limits
|
// Open a transaction in case we're writing a new secret; this limits
|
||||||
// the amount of code which handles secret plaintexts.
|
// the amount of code which handles secret plaintexts.
|
||||||
$credential->openTransaction();
|
$credential->openTransaction();
|
||||||
|
@ -244,13 +251,13 @@ final class PassphraseCredentialEditController extends PassphraseController {
|
||||||
->setValue($type->getCredentialTypeName()))
|
->setValue($type->getCredentialTypeName()))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormDividerControl()))
|
id(new AphrontFormDividerControl()))
|
||||||
->appendChild(
|
->appendControl(
|
||||||
id(new AphrontFormPolicyControl())
|
id(new AphrontFormPolicyControl())
|
||||||
->setName('viewPolicy')
|
->setName('viewPolicy')
|
||||||
->setPolicyObject($credential)
|
->setPolicyObject($credential)
|
||||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
|
->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
|
||||||
->setPolicies($policies))
|
->setPolicies($policies))
|
||||||
->appendChild(
|
->appendControl(
|
||||||
id(new AphrontFormPolicyControl())
|
id(new AphrontFormPolicyControl())
|
||||||
->setName('editPolicy')
|
->setName('editPolicy')
|
||||||
->setPolicyObject($credential)
|
->setPolicyObject($credential)
|
||||||
|
|
|
@ -4,7 +4,8 @@ final class PassphraseCredential extends PassphraseDAO
|
||||||
implements
|
implements
|
||||||
PhabricatorApplicationTransactionInterface,
|
PhabricatorApplicationTransactionInterface,
|
||||||
PhabricatorPolicyInterface,
|
PhabricatorPolicyInterface,
|
||||||
PhabricatorDestructibleInterface {
|
PhabricatorDestructibleInterface,
|
||||||
|
PhabricatorSpacesInterface {
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $credentialType;
|
protected $credentialType;
|
||||||
|
@ -18,6 +19,7 @@ final class PassphraseCredential extends PassphraseDAO
|
||||||
protected $isLocked = 0;
|
protected $isLocked = 0;
|
||||||
protected $allowConduit = 0;
|
protected $allowConduit = 0;
|
||||||
protected $authorPHID;
|
protected $authorPHID;
|
||||||
|
protected $spacePHID;
|
||||||
|
|
||||||
private $secret = self::ATTACHABLE;
|
private $secret = self::ATTACHABLE;
|
||||||
|
|
||||||
|
@ -37,7 +39,8 @@ final class PassphraseCredential extends PassphraseDAO
|
||||||
->setIsDestroyed(0)
|
->setIsDestroyed(0)
|
||||||
->setAuthorPHID($actor->getPHID())
|
->setAuthorPHID($actor->getPHID())
|
||||||
->setViewPolicy($view_policy)
|
->setViewPolicy($view_policy)
|
||||||
->setEditPolicy($edit_policy);
|
->setEditPolicy($edit_policy)
|
||||||
|
->setSpacePHID($actor->getDefaultSpacePHID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMonogram() {
|
public function getMonogram() {
|
||||||
|
@ -158,4 +161,13 @@ final class PassphraseCredential extends PassphraseDAO
|
||||||
$this->delete();
|
$this->delete();
|
||||||
$this->saveTransaction();
|
$this->saveTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorSpacesInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function getSpacePHID() {
|
||||||
|
return $this->spacePHID;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue