Skip to content

Commit e29955b

Browse files
author
epriestley
committed
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
1 parent 6f0d3b0 commit e29955b

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RENAME TABLE {$NAMESPACE}_user.user_sshkey TO {$NAMESPACE}_auth.auth_sshkey;

src/__phutil_library_map__.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,7 @@
13171317
'PhabricatorAuthProviderConfigTransactionQuery' => 'applications/auth/query/PhabricatorAuthProviderConfigTransactionQuery.php',
13181318
'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php',
13191319
'PhabricatorAuthRevokeTokenController' => 'applications/auth/controller/PhabricatorAuthRevokeTokenController.php',
1320+
'PhabricatorAuthSSHKey' => 'applications/auth/storage/PhabricatorAuthSSHKey.php',
13201321
'PhabricatorAuthSSHKeyQuery' => 'applications/auth/query/PhabricatorAuthSSHKeyQuery.php',
13211322
'PhabricatorAuthSSHPublicKey' => 'applications/auth/storage/PhabricatorAuthSSHPublicKey.php',
13221323
'PhabricatorAuthSession' => 'applications/auth/storage/PhabricatorAuthSession.php',
@@ -2488,7 +2489,6 @@
24882489
'PhabricatorUserProfileEditor' => 'applications/people/editor/PhabricatorUserProfileEditor.php',
24892490
'PhabricatorUserRealNameField' => 'applications/people/customfield/PhabricatorUserRealNameField.php',
24902491
'PhabricatorUserRolesField' => 'applications/people/customfield/PhabricatorUserRolesField.php',
2491-
'PhabricatorUserSSHKey' => 'applications/settings/storage/PhabricatorUserSSHKey.php',
24922492
'PhabricatorUserSchemaSpec' => 'applications/people/storage/PhabricatorUserSchemaSpec.php',
24932493
'PhabricatorUserSearchIndexer' => 'applications/people/search/PhabricatorUserSearchIndexer.php',
24942494
'PhabricatorUserSinceField' => 'applications/people/customfield/PhabricatorUserSinceField.php',
@@ -4383,6 +4383,10 @@
43834383
'PhabricatorAuthProviderConfigTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
43844384
'PhabricatorAuthRegisterController' => 'PhabricatorAuthController',
43854385
'PhabricatorAuthRevokeTokenController' => 'PhabricatorAuthController',
4386+
'PhabricatorAuthSSHKey' => array(
4387+
'PhabricatorAuthDAO',
4388+
'PhabricatorPolicyInterface',
4389+
),
43864390
'PhabricatorAuthSSHKeyQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
43874391
'PhabricatorAuthSSHPublicKey' => 'Phobject',
43884392
'PhabricatorAuthSession' => array(
@@ -5631,10 +5635,6 @@
56315635
'PhabricatorUserProfileEditor' => 'PhabricatorApplicationTransactionEditor',
56325636
'PhabricatorUserRealNameField' => 'PhabricatorUserCustomField',
56335637
'PhabricatorUserRolesField' => 'PhabricatorUserCustomField',
5634-
'PhabricatorUserSSHKey' => array(
5635-
'PhabricatorUserDAO',
5636-
'PhabricatorPolicyInterface',
5637-
),
56385638
'PhabricatorUserSchemaSpec' => 'PhabricatorConfigSchemaSpec',
56395639
'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
56405640
'PhabricatorUserSinceField' => 'PhabricatorUserCustomField',

src/applications/auth/query/PhabricatorAuthSSHKeyQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function withKeys(array $keys) {
2424
}
2525

2626
protected function loadPage() {
27-
$table = new PhabricatorUserSSHKey();
27+
$table = new PhabricatorAuthSSHKey();
2828
$conn_r = $table->establishConnection('r');
2929

3030
$data = queryfx_all(

src/applications/settings/storage/PhabricatorUserSSHKey.php renamed to src/applications/auth/storage/PhabricatorAuthSSHKey.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

3-
final class PhabricatorUserSSHKey
4-
extends PhabricatorUserDAO
3+
final class PhabricatorAuthSSHKey
4+
extends PhabricatorAuthDAO
55
implements PhabricatorPolicyInterface {
66

77
protected $userPHID;

src/applications/people/storage/PhabricatorUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ public function destroyObjectPermanently(
896896
$profile->delete();
897897
}
898898

899-
$keys = id(new PhabricatorUserSSHKey())->loadAllWhere(
899+
$keys = id(new PhabricatorAuthSSHKey())->loadAllWhere(
900900
'userPHID = %s',
901901
$this->getPHID());
902902
foreach ($keys as $key) {

src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function processRequest(AphrontRequest $request) {
5959
return new Aphront404Response();
6060
}
6161
} else {
62-
$key = new PhabricatorUserSSHKey();
62+
$key = new PhabricatorAuthSSHKey();
6363
$key->setUserPHID($user->getPHID());
6464
}
6565

@@ -251,7 +251,7 @@ private function renderKeyListView(AphrontRequest $request) {
251251

252252
private function processDelete(
253253
AphrontRequest $request,
254-
PhabricatorUserSSHKey $key) {
254+
PhabricatorAuthSSHKey $key) {
255255

256256
$viewer = $request->getUser();
257257
$user = $this->getUser();
@@ -308,7 +308,7 @@ private function processGenerate(AphrontRequest $request) {
308308
$type = $public_key->getType();
309309
$body = $public_key->getBody();
310310

311-
$key = id(new PhabricatorUserSSHKey())
311+
$key = id(new PhabricatorAuthSSHKey())
312312
->setUserPHID($user->getPHID())
313313
->setName('id_rsa_phabricator')
314314
->setKeyType($type)

0 commit comments

Comments
 (0)