Move SSHKey table to Auth database
Summary: Ref T5833. Since these will no longer be bound specifically to users, bring them to a more central location. Test Plan: - Edited SSH keys. - Ran `bin/ssh-auth` and `bin/ssh-auth-key`. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5833 Differential Revision: https://secure.phabricator.com/D10791
This commit is contained in:
1
resources/sql/autopatches/20141105.ssh.1.rename.sql
Normal file
1
resources/sql/autopatches/20141105.ssh.1.rename.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
RENAME TABLE {$NAMESPACE}_user.user_sshkey TO {$NAMESPACE}_auth.auth_sshkey;
|
||||||
@@ -1317,6 +1317,7 @@ phutil_register_library_map(array(
|
|||||||
'PhabricatorAuthProviderConfigTransactionQuery' => 'applications/auth/query/PhabricatorAuthProviderConfigTransactionQuery.php',
|
'PhabricatorAuthProviderConfigTransactionQuery' => 'applications/auth/query/PhabricatorAuthProviderConfigTransactionQuery.php',
|
||||||
'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php',
|
'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php',
|
||||||
'PhabricatorAuthRevokeTokenController' => 'applications/auth/controller/PhabricatorAuthRevokeTokenController.php',
|
'PhabricatorAuthRevokeTokenController' => 'applications/auth/controller/PhabricatorAuthRevokeTokenController.php',
|
||||||
|
'PhabricatorAuthSSHKey' => 'applications/auth/storage/PhabricatorAuthSSHKey.php',
|
||||||
'PhabricatorAuthSSHKeyQuery' => 'applications/auth/query/PhabricatorAuthSSHKeyQuery.php',
|
'PhabricatorAuthSSHKeyQuery' => 'applications/auth/query/PhabricatorAuthSSHKeyQuery.php',
|
||||||
'PhabricatorAuthSSHPublicKey' => 'applications/auth/storage/PhabricatorAuthSSHPublicKey.php',
|
'PhabricatorAuthSSHPublicKey' => 'applications/auth/storage/PhabricatorAuthSSHPublicKey.php',
|
||||||
'PhabricatorAuthSession' => 'applications/auth/storage/PhabricatorAuthSession.php',
|
'PhabricatorAuthSession' => 'applications/auth/storage/PhabricatorAuthSession.php',
|
||||||
@@ -2488,7 +2489,6 @@ phutil_register_library_map(array(
|
|||||||
'PhabricatorUserProfileEditor' => 'applications/people/editor/PhabricatorUserProfileEditor.php',
|
'PhabricatorUserProfileEditor' => 'applications/people/editor/PhabricatorUserProfileEditor.php',
|
||||||
'PhabricatorUserRealNameField' => 'applications/people/customfield/PhabricatorUserRealNameField.php',
|
'PhabricatorUserRealNameField' => 'applications/people/customfield/PhabricatorUserRealNameField.php',
|
||||||
'PhabricatorUserRolesField' => 'applications/people/customfield/PhabricatorUserRolesField.php',
|
'PhabricatorUserRolesField' => 'applications/people/customfield/PhabricatorUserRolesField.php',
|
||||||
'PhabricatorUserSSHKey' => 'applications/settings/storage/PhabricatorUserSSHKey.php',
|
|
||||||
'PhabricatorUserSchemaSpec' => 'applications/people/storage/PhabricatorUserSchemaSpec.php',
|
'PhabricatorUserSchemaSpec' => 'applications/people/storage/PhabricatorUserSchemaSpec.php',
|
||||||
'PhabricatorUserSearchIndexer' => 'applications/people/search/PhabricatorUserSearchIndexer.php',
|
'PhabricatorUserSearchIndexer' => 'applications/people/search/PhabricatorUserSearchIndexer.php',
|
||||||
'PhabricatorUserSinceField' => 'applications/people/customfield/PhabricatorUserSinceField.php',
|
'PhabricatorUserSinceField' => 'applications/people/customfield/PhabricatorUserSinceField.php',
|
||||||
@@ -4383,6 +4383,10 @@ phutil_register_library_map(array(
|
|||||||
'PhabricatorAuthProviderConfigTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
'PhabricatorAuthProviderConfigTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
'PhabricatorAuthRegisterController' => 'PhabricatorAuthController',
|
'PhabricatorAuthRegisterController' => 'PhabricatorAuthController',
|
||||||
'PhabricatorAuthRevokeTokenController' => 'PhabricatorAuthController',
|
'PhabricatorAuthRevokeTokenController' => 'PhabricatorAuthController',
|
||||||
|
'PhabricatorAuthSSHKey' => array(
|
||||||
|
'PhabricatorAuthDAO',
|
||||||
|
'PhabricatorPolicyInterface',
|
||||||
|
),
|
||||||
'PhabricatorAuthSSHKeyQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorAuthSSHKeyQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorAuthSSHPublicKey' => 'Phobject',
|
'PhabricatorAuthSSHPublicKey' => 'Phobject',
|
||||||
'PhabricatorAuthSession' => array(
|
'PhabricatorAuthSession' => array(
|
||||||
@@ -5631,10 +5635,6 @@ phutil_register_library_map(array(
|
|||||||
'PhabricatorUserProfileEditor' => 'PhabricatorApplicationTransactionEditor',
|
'PhabricatorUserProfileEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'PhabricatorUserRealNameField' => 'PhabricatorUserCustomField',
|
'PhabricatorUserRealNameField' => 'PhabricatorUserCustomField',
|
||||||
'PhabricatorUserRolesField' => 'PhabricatorUserCustomField',
|
'PhabricatorUserRolesField' => 'PhabricatorUserCustomField',
|
||||||
'PhabricatorUserSSHKey' => array(
|
|
||||||
'PhabricatorUserDAO',
|
|
||||||
'PhabricatorPolicyInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorUserSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
'PhabricatorUserSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||||
'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||||
'PhabricatorUserSinceField' => 'PhabricatorUserCustomField',
|
'PhabricatorUserSinceField' => 'PhabricatorUserCustomField',
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ final class PhabricatorAuthSSHKeyQuery
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function loadPage() {
|
protected function loadPage() {
|
||||||
$table = new PhabricatorUserSSHKey();
|
$table = new PhabricatorAuthSSHKey();
|
||||||
$conn_r = $table->establishConnection('r');
|
$conn_r = $table->establishConnection('r');
|
||||||
|
|
||||||
$data = queryfx_all(
|
$data = queryfx_all(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorUserSSHKey
|
final class PhabricatorAuthSSHKey
|
||||||
extends PhabricatorUserDAO
|
extends PhabricatorAuthDAO
|
||||||
implements PhabricatorPolicyInterface {
|
implements PhabricatorPolicyInterface {
|
||||||
|
|
||||||
protected $userPHID;
|
protected $userPHID;
|
||||||
@@ -896,7 +896,7 @@ EOBODY;
|
|||||||
$profile->delete();
|
$profile->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$keys = id(new PhabricatorUserSSHKey())->loadAllWhere(
|
$keys = id(new PhabricatorAuthSSHKey())->loadAllWhere(
|
||||||
'userPHID = %s',
|
'userPHID = %s',
|
||||||
$this->getPHID());
|
$this->getPHID());
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ final class PhabricatorSettingsPanelSSHKeys
|
|||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$key = new PhabricatorUserSSHKey();
|
$key = new PhabricatorAuthSSHKey();
|
||||||
$key->setUserPHID($user->getPHID());
|
$key->setUserPHID($user->getPHID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ final class PhabricatorSettingsPanelSSHKeys
|
|||||||
|
|
||||||
private function processDelete(
|
private function processDelete(
|
||||||
AphrontRequest $request,
|
AphrontRequest $request,
|
||||||
PhabricatorUserSSHKey $key) {
|
PhabricatorAuthSSHKey $key) {
|
||||||
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
@@ -308,7 +308,7 @@ final class PhabricatorSettingsPanelSSHKeys
|
|||||||
$type = $public_key->getType();
|
$type = $public_key->getType();
|
||||||
$body = $public_key->getBody();
|
$body = $public_key->getBody();
|
||||||
|
|
||||||
$key = id(new PhabricatorUserSSHKey())
|
$key = id(new PhabricatorAuthSSHKey())
|
||||||
->setUserPHID($user->getPHID())
|
->setUserPHID($user->getPHID())
|
||||||
->setName('id_rsa_phabricator')
|
->setName('id_rsa_phabricator')
|
||||||
->setKeyType($type)
|
->setKeyType($type)
|
||||||
|
|||||||
Reference in New Issue
Block a user