Page MenuHomePhabricator

D13386.diff
No OneTemporary

D13386.diff

diff --git a/resources/sql/autopatches/20150621.phrase.2.sql b/resources/sql/autopatches/20150621.phrase.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150621.phrase.2.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_passphrase.passphrase_credential
+ ADD spacePHID VARBINARY(64);
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4781,6 +4781,7 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorDestructibleInterface',
+ 'PhabricatorSpacesInterface',
),
'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule',
'PassphraseCredentialConduitController' => 'PassphraseController',
diff --git a/src/applications/passphrase/controller/PassphraseCredentialEditController.php b/src/applications/passphrase/controller/PassphraseCredentialEditController.php
--- a/src/applications/passphrase/controller/PassphraseCredentialEditController.php
+++ b/src/applications/passphrase/controller/PassphraseCredentialEditController.php
@@ -60,6 +60,7 @@
$e_name = true;
$v_desc = $credential->getDescription();
+ $v_space = $credential->getSpacePHID();
$v_username = $credential->getUsername();
$e_username = true;
@@ -93,6 +94,7 @@
$v_is_locked = $request->getStr('lock');
$v_secret = $request->getStr('secret');
+ $v_space = $request->getStr('spacePHID');
$v_password = $request->getStr('password');
$v_decrypt = $v_secret;
@@ -127,6 +129,7 @@
$type_is_locked = PassphraseCredentialTransaction::TYPE_LOCK;
$type_view_policy = PhabricatorTransactions::TYPE_VIEW_POLICY;
$type_edit_policy = PhabricatorTransactions::TYPE_EDIT_POLICY;
+ $type_space = PhabricatorTransactions::TYPE_SPACE;
$xactions = array();
@@ -146,6 +149,10 @@
->setTransactionType($type_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
// the amount of code which handles secret plaintexts.
$credential->openTransaction();
@@ -244,13 +251,13 @@
->setValue($type->getCredentialTypeName()))
->appendChild(
id(new AphrontFormDividerControl()))
- ->appendChild(
+ ->appendControl(
id(new AphrontFormPolicyControl())
->setName('viewPolicy')
->setPolicyObject($credential)
->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
->setPolicies($policies))
- ->appendChild(
+ ->appendControl(
id(new AphrontFormPolicyControl())
->setName('editPolicy')
->setPolicyObject($credential)
diff --git a/src/applications/passphrase/storage/PassphraseCredential.php b/src/applications/passphrase/storage/PassphraseCredential.php
--- a/src/applications/passphrase/storage/PassphraseCredential.php
+++ b/src/applications/passphrase/storage/PassphraseCredential.php
@@ -4,7 +4,8 @@
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
- PhabricatorDestructibleInterface {
+ PhabricatorDestructibleInterface,
+ PhabricatorSpacesInterface {
protected $name;
protected $credentialType;
@@ -18,6 +19,7 @@
protected $isLocked = 0;
protected $allowConduit = 0;
protected $authorPHID;
+ protected $spacePHID;
private $secret = self::ATTACHABLE;
@@ -37,7 +39,8 @@
->setIsDestroyed(0)
->setAuthorPHID($actor->getPHID())
->setViewPolicy($view_policy)
- ->setEditPolicy($edit_policy);
+ ->setEditPolicy($edit_policy)
+ ->setSpacePHID($actor->getDefaultSpacePHID());
}
public function getMonogram() {
@@ -158,4 +161,13 @@
$this->delete();
$this->saveTransaction();
}
+
+
+/* -( PhabricatorSpacesInterface )----------------------------------------- */
+
+
+ public function getSpacePHID() {
+ return $this->spacePHID;
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Tue, May 21, 5:15 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6284281
Default Alt Text
D13386.diff (4 KB)

Event Timeline