1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Allow linking to passphrase credential via remarkup

Summary: Fixes T5421, add linking to passphrase credentials

Test Plan: Open task, add a comment of '{K1}' where K1 is a passphrase credential. Preview and actual comment should be link to credential with the content of credential.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5421

Differential Revision: https://secure.phabricator.com/D9725
This commit is contained in:
epriestley 2014-06-25 14:58:56 -07:00
parent 2d20dc89f7
commit 83cfbe7bb4
3 changed files with 27 additions and 0 deletions

View file

@ -1089,6 +1089,7 @@ phutil_register_library_map(array(
'PassphraseDAO' => 'applications/passphrase/storage/PassphraseDAO.php',
'PassphrasePHIDTypeCredential' => 'applications/passphrase/phid/PassphrasePHIDTypeCredential.php',
'PassphrasePasswordKey' => 'applications/passphrase/keys/PassphrasePasswordKey.php',
'PassphraseRemarkupRule' => 'applications/passphrase/remarkup/PassphraseRemarkupRule.php',
'PassphraseSSHKey' => 'applications/passphrase/keys/PassphraseSSHKey.php',
'PassphraseSecret' => 'applications/passphrase/storage/PassphraseSecret.php',
'PasteCapabilityDefaultView' => 'applications/paste/capability/PasteCapabilityDefaultView.php',
@ -3868,6 +3869,7 @@ phutil_register_library_map(array(
'PassphraseDAO' => 'PhabricatorLiskDAO',
'PassphrasePHIDTypeCredential' => 'PhabricatorPHIDType',
'PassphrasePasswordKey' => 'PassphraseAbstractKey',
'PassphraseRemarkupRule' => 'PhabricatorRemarkupRuleObject',
'PassphraseSSHKey' => 'PassphraseAbstractKey',
'PassphraseSecret' => 'PassphraseDAO',
'PasteCapabilityDefaultView' => 'PhabricatorPolicyCapability',

View file

@ -45,4 +45,10 @@ final class PhabricatorApplicationPassphrase extends PhabricatorApplication {
));
}
public function getRemarkupRules() {
return array(
new PassphraseRemarkupRule(),
);
}
}

View file

@ -0,0 +1,19 @@
<?php
final class PassphraseRemarkupRule
extends PhabricatorRemarkupRuleObject {
protected function getObjectNamePrefix() {
return 'K';
}
protected function loadObjects(array $ids) {
$viewer = $this->getEngine()->getConfig('viewer');
return id(new PassphraseCredentialQuery())
->setViewer($viewer)
->withIDs($ids)
->execute();
}
}