mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Support Ferret engine for Passphrase credentials
Summary: Ref T12819. Adds Ferret support to Passphrase. Test Plan: Indexed credentials, searched for credentials. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12819 Differential Revision: https://secure.phabricator.com/D18556
This commit is contained in:
parent
f23717b416
commit
2020c1e7bd
10 changed files with 116 additions and 8 deletions
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_passphrase.passphrase_credential_fdocument (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
objectPHID VARBINARY(64) NOT NULL,
|
||||||
|
isClosed BOOL NOT NULL,
|
||||||
|
authorPHID VARBINARY(64),
|
||||||
|
ownerPHID VARBINARY(64),
|
||||||
|
epochCreated INT UNSIGNED NOT NULL,
|
||||||
|
epochModified INT UNSIGNED NOT NULL
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -0,0 +1,8 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_passphrase.passphrase_credential_ffield (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
documentID INT UNSIGNED NOT NULL,
|
||||||
|
fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT},
|
||||||
|
rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT},
|
||||||
|
termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT},
|
||||||
|
normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -0,0 +1,5 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_passphrase.passphrase_credential_fngrams (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
documentID INT UNSIGNED NOT NULL,
|
||||||
|
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT}
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -1840,6 +1840,10 @@ phutil_register_library_map(array(
|
||||||
'PassphraseCredentialDestroyController' => 'applications/passphrase/controller/PassphraseCredentialDestroyController.php',
|
'PassphraseCredentialDestroyController' => 'applications/passphrase/controller/PassphraseCredentialDestroyController.php',
|
||||||
'PassphraseCredentialDestroyTransaction' => 'applications/passphrase/xaction/PassphraseCredentialDestroyTransaction.php',
|
'PassphraseCredentialDestroyTransaction' => 'applications/passphrase/xaction/PassphraseCredentialDestroyTransaction.php',
|
||||||
'PassphraseCredentialEditController' => 'applications/passphrase/controller/PassphraseCredentialEditController.php',
|
'PassphraseCredentialEditController' => 'applications/passphrase/controller/PassphraseCredentialEditController.php',
|
||||||
|
'PassphraseCredentialFerretDocument' => 'applications/passphrase/storage/PassphraseCredentialFerretDocument.php',
|
||||||
|
'PassphraseCredentialFerretEngine' => 'applications/passphrase/search/PassphraseCredentialFerretEngine.php',
|
||||||
|
'PassphraseCredentialFerretField' => 'applications/passphrase/storage/PassphraseCredentialFerretField.php',
|
||||||
|
'PassphraseCredentialFerretNgrams' => 'applications/passphrase/storage/PassphraseCredentialFerretNgrams.php',
|
||||||
'PassphraseCredentialFulltextEngine' => 'applications/passphrase/search/PassphraseCredentialFulltextEngine.php',
|
'PassphraseCredentialFulltextEngine' => 'applications/passphrase/search/PassphraseCredentialFulltextEngine.php',
|
||||||
'PassphraseCredentialListController' => 'applications/passphrase/controller/PassphraseCredentialListController.php',
|
'PassphraseCredentialListController' => 'applications/passphrase/controller/PassphraseCredentialListController.php',
|
||||||
'PassphraseCredentialLockController' => 'applications/passphrase/controller/PassphraseCredentialLockController.php',
|
'PassphraseCredentialLockController' => 'applications/passphrase/controller/PassphraseCredentialLockController.php',
|
||||||
|
@ -7034,6 +7038,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDestructibleInterface',
|
'PhabricatorDestructibleInterface',
|
||||||
'PhabricatorSpacesInterface',
|
'PhabricatorSpacesInterface',
|
||||||
'PhabricatorFulltextInterface',
|
'PhabricatorFulltextInterface',
|
||||||
|
'PhabricatorFerretInterface',
|
||||||
),
|
),
|
||||||
'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule',
|
'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule',
|
||||||
'PassphraseCredentialConduitController' => 'PassphraseController',
|
'PassphraseCredentialConduitController' => 'PassphraseController',
|
||||||
|
@ -7044,6 +7049,10 @@ phutil_register_library_map(array(
|
||||||
'PassphraseCredentialDestroyController' => 'PassphraseController',
|
'PassphraseCredentialDestroyController' => 'PassphraseController',
|
||||||
'PassphraseCredentialDestroyTransaction' => 'PassphraseCredentialTransactionType',
|
'PassphraseCredentialDestroyTransaction' => 'PassphraseCredentialTransactionType',
|
||||||
'PassphraseCredentialEditController' => 'PassphraseController',
|
'PassphraseCredentialEditController' => 'PassphraseController',
|
||||||
|
'PassphraseCredentialFerretDocument' => 'PhabricatorFerretDocument',
|
||||||
|
'PassphraseCredentialFerretEngine' => 'PhabricatorFerretEngine',
|
||||||
|
'PassphraseCredentialFerretField' => 'PhabricatorFerretField',
|
||||||
|
'PassphraseCredentialFerretNgrams' => 'PhabricatorFerretNgrams',
|
||||||
'PassphraseCredentialFulltextEngine' => 'PhabricatorFulltextEngine',
|
'PassphraseCredentialFulltextEngine' => 'PhabricatorFulltextEngine',
|
||||||
'PassphraseCredentialListController' => 'PassphraseController',
|
'PassphraseCredentialListController' => 'PassphraseController',
|
||||||
'PassphraseCredentialLockController' => 'PassphraseController',
|
'PassphraseCredentialLockController' => 'PassphraseController',
|
||||||
|
|
|
@ -109,49 +109,49 @@ final class PassphraseCredentialQuery
|
||||||
if ($this->ids !== null) {
|
if ($this->ids !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'id IN (%Ld)',
|
'c.id IN (%Ld)',
|
||||||
$this->ids);
|
$this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->phids !== null) {
|
if ($this->phids !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'phid IN (%Ls)',
|
'c.phid IN (%Ls)',
|
||||||
$this->phids);
|
$this->phids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->credentialTypes !== null) {
|
if ($this->credentialTypes !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'credentialType in (%Ls)',
|
'c.credentialType in (%Ls)',
|
||||||
$this->credentialTypes);
|
$this->credentialTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->providesTypes !== null) {
|
if ($this->providesTypes !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'providesType IN (%Ls)',
|
'c.providesType IN (%Ls)',
|
||||||
$this->providesTypes);
|
$this->providesTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isDestroyed !== null) {
|
if ($this->isDestroyed !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'isDestroyed = %d',
|
'c.isDestroyed = %d',
|
||||||
(int)$this->isDestroyed);
|
(int)$this->isDestroyed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->allowConduit !== null) {
|
if ($this->allowConduit !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'allowConduit = %d',
|
'c.allowConduit = %d',
|
||||||
(int)$this->allowConduit);
|
(int)$this->allowConduit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->nameContains)) {
|
if (strlen($this->nameContains)) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'LOWER(name) LIKE %~',
|
'LOWER(c.name) LIKE %~',
|
||||||
phutil_utf8_strtolower($this->nameContains));
|
phutil_utf8_strtolower($this->nameContains));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,4 +162,8 @@ final class PassphraseCredentialQuery
|
||||||
return 'PhabricatorPassphraseApplication';
|
return 'PhabricatorPassphraseApplication';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getPrimaryTableAlias() {
|
||||||
|
return 'c';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PassphraseCredentialFerretEngine
|
||||||
|
extends PhabricatorFerretEngine {
|
||||||
|
|
||||||
|
public function newNgramsObject() {
|
||||||
|
return new PassphraseCredentialFerretNgrams();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newDocumentObject() {
|
||||||
|
return new PassphraseCredentialFerretDocument();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newFieldObject() {
|
||||||
|
return new PassphraseCredentialFerretField();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newSearchEngine() {
|
||||||
|
return new PassphraseCredentialSearchEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ final class PassphraseCredential extends PassphraseDAO
|
||||||
PhabricatorSubscribableInterface,
|
PhabricatorSubscribableInterface,
|
||||||
PhabricatorDestructibleInterface,
|
PhabricatorDestructibleInterface,
|
||||||
PhabricatorSpacesInterface,
|
PhabricatorSpacesInterface,
|
||||||
PhabricatorFulltextInterface {
|
PhabricatorFulltextInterface,
|
||||||
|
PhabricatorFerretInterface {
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $credentialType;
|
protected $credentialType;
|
||||||
|
@ -197,4 +198,12 @@ final class PassphraseCredential extends PassphraseDAO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorFerretInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function newFerretEngine() {
|
||||||
|
return new PassphraseCredentialFerretEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PassphraseCredentialFerretDocument
|
||||||
|
extends PhabricatorFerretDocument {
|
||||||
|
|
||||||
|
public function getApplicationName() {
|
||||||
|
return 'passphrase';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIndexKey() {
|
||||||
|
return 'credential';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PassphraseCredentialFerretField
|
||||||
|
extends PhabricatorFerretField {
|
||||||
|
|
||||||
|
public function getApplicationName() {
|
||||||
|
return 'passphrase';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIndexKey() {
|
||||||
|
return 'credential';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PassphraseCredentialFerretNgrams
|
||||||
|
extends PhabricatorFerretNgrams {
|
||||||
|
|
||||||
|
public function getApplicationName() {
|
||||||
|
return 'passphrase';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIndexKey() {
|
||||||
|
return 'credential';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue