More fun with my company switching to the new Ubuntu 11.10…

With Gnome 3, new authorization dialogs have been introduced to interface with PolicyKit (I love all those KITs by the way…), you can see them at this gnome live page. The company policy is to set up Ubuntu in the same way for everyone, and all the machines have several users that are allowed to install software. They are in one group — Ubuntu policy is to not use the root user.

As a developer, I am allowed to install software through the Ubuntu software center, or should be, anyways. With the Gnome 3 PolicyKit authorization dialog, choice between several possible users has been simplified, i.e. removed! So I get asked to enter the password for the “IT Administrator” account, which I obviously don’t know. Effectively resulting in me not being able to install any software.

I had to patch the gnome-shell (again) to restore at least basic usability. It asks for the current user password, when this user is permitted to perform that function (instead of the “first” one, whichever that might be.)

get the Gnome 3 PolicyKit fix here

Yes, there are bug reports for this

--- polkitAuthenticationAgent.js_web   2011-10-24 11:55:26.000000000 +0200
+++ polkitAuthenticationAgent.js    2011-10-26 13:31:28.350313323 +0200
@@ -24,6 +24,7 @@ const Lang = imports.lang;
 const Signals = imports.signals;
 const Shell = imports.gi.Shell;
 const AccountsService = imports.gi.AccountsService;
+const GLib = imports.gi.GLib;
 const Clutter = imports.gi.Clutter;
 const St = imports.gi.St;
 const Pango = imports.gi.Pango;
@@ -85,13 +85,25 @@ AuthenticationDialog.prototype = {
                        { y_fill:  true,
                          y_align: St.Align.START });
 
+        let chosenIndex = 0;
+
         if (userNames.length > 1) {
+            let thisUser = GLib.get_user_name();
+            for (let i = 0; i < userNames.length; i++) {
+                if (userNames[i] == thisUser) {
+                    chosenIndex = i;
+                    break;
+                }
+                else if (userNames[i] == 'root') {
+                    chosenIndex = i;
+                }
+            }
             log('polkitAuthenticationAgent: Received ' + userNames.length +
                 ' identities that can be used for authentication. Only ' +
-                'considering the first one.');
+                'considering the ' + (1+chosenIndex) + ' one.');
         }
 
-        let userName = userNames[0];
+        let userName = userNames[chosenIndex];
 
         this._user = AccountsService.UserManager.get_default().get_user(userName);
         let userRealName = this._user.get_real_name()