Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/52944


Change subject: Add Manage ssh keys link to Special:Preferences
......................................................................

Add Manage ssh keys link to Special:Preferences

Part of bug 40092 sort of

Change-Id: I9bb430305e52d48d5b8c6580f5278500e738397d
---
M OpenStackManager.i18n.php
M OpenStackManager.php
M nova/OpenStackNovaUser.php
3 files changed, 25 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenStackManager 
refs/changes/44/52944/1

diff --git a/OpenStackManager.i18n.php b/OpenStackManager.i18n.php
index 647a3e7..028da70 100644
--- a/OpenStackManager.i18n.php
+++ b/OpenStackManager.i18n.php
@@ -169,6 +169,7 @@
        'openstackmanager-detachvolumefailed' => 'Failed to detach volume.',
 
        'openstackmanager-novapublickey' => 'Public SSH key',
+       'openstackmanager-prefs-novapublickey' => 'Public SSH keys:',
        'openstackmanager-deletekey' => 'Delete key',
        'openstackmanager-deletekeyconfirm' => 'Are you sure you wish to delete 
the above key?',
        'openstackmanager-keylist' => 'Key list',
diff --git a/OpenStackManager.php b/OpenStackManager.php
index b75c954..05acf35 100644
--- a/OpenStackManager.php
+++ b/OpenStackManager.php
@@ -182,6 +182,7 @@
 $wgHooks['LDAPUpdateUser'][] = 'OpenStackNovaUser::LDAPUpdateUser';
 $wgHooks['DynamicSidebarGetGroups'][] = 
'OpenStackNovaUser::DynamicSidebarGetGroups';
 $wgHooks['ChainAuth'][] = 'OpenStackNovaUser::ChainAuth';
+$wgHooks['GetPreferences'][] = 'OpenStackNovaUser::manageSSHKey';
 
 $commonModuleInfo = array(
        'localBasePath' => dirname( __FILE__ ) . '/modules',
diff --git a/nova/OpenStackNovaUser.php b/nova/OpenStackNovaUser.php
index 3d2eb77..95e6258 100644
--- a/nova/OpenStackNovaUser.php
+++ b/nova/OpenStackNovaUser.php
@@ -353,10 +353,10 @@
         */
        static function uuid4() {
                $uuid = '';
-               uuid_create( &$uuid );
+               uuid_create( $uuid );
                uuid_make( $uuid, UUID_MAKE_V4 );
                $uuidExport = '';
-               uuid_export( $uuid, UUID_FMT_STR, &$uuidExport );
+               uuid_export( $uuid, UUID_FMT_STR, $uuidExport );
                return trim( $uuidExport );
        }
 
@@ -640,4 +640,25 @@
                return True;
        }
 
+       /**
+        * @param $user User
+        * @param $preferences array
+        * @return bool True
+        */
+       public static function manageSSHKey( User $user, array &$preferences ) {
+               $link = Linker::link( SpecialPage::getTitleFor( 'NovaKey' ),
+                       wfMessage( 'novakey' )->escaped(),
+                       array(),
+                       array( 'returnto' => SpecialPage::getTitleFor( 
'Preferences' )->getPrefixedText() )
+               );
+
+               $preferences['sshkey'] = array(
+                       'type' => 'info',
+                       'raw' => true,
+                       'default' => $link,
+                       'label-message' => 
'openstackmanager-prefs-novapublickey',
+                       'section' => 'personal/info',
+               );
+               return true;
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/52944
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9bb430305e52d48d5b8c6580f5278500e738397d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to