Update to latest PolicyKit API
authorDavid Zeuthen <davidz@redhat.com>
Wed, 13 May 2009 15:00:53 +0000 (11:00 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Wed, 13 May 2009 15:00:53 +0000 (11:00 -0400)
configure.ac
po/LINGUAS
po/POTFILES.in
po/da.po [new file with mode: 0644]
policy/org.freedesktop.devicekit.disks.policy.in
src/Makefile.am
src/devkit-disks-ata-smart-db.c
src/devkit-disks-daemon.c
src/devkit-disks-daemon.h
src/devkit-disks-device.c
src/devkit-disks-polkit-action-lookup.c [new file with mode: 0644]

index f45a26f..0a90748 100644 (file)
@@ -141,16 +141,14 @@ PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.74])
 AC_SUBST(DBUS_GLIB_CFLAGS)
 AC_SUBST(DBUS_GLIB_LIBS)
 
-msg_polkit_gobject_1=no
-PKG_CHECK_MODULES(POLKIT_GOBJECT_1,
-                  polkit-gobject-1 >= 0.92,
-                  [AM_CONDITIONAL(HAVE_POLKIT_GOBJECT_1, true)
-                   AC_DEFINE(HAVE_POLKIT_GOBJECT_1, [], [Set if polkit-gobject-1 is available])]
-                   msg_polkit_gobject_1=yes,
-                   [AM_CONDITIONAL(HAVE_POLKIT_GOBJECT_1, false)])
+PKG_CHECK_MODULES(POLKIT_GOBJECT_1, [polkit-gobject-1 >= 0.92])
 AC_SUBST(POLKIT_GOBJECT_1_CFLAGS)
 AC_SUBST(POLKIT_GOBJECT_1_LIBS)
 
+PKG_CHECK_MODULES(POLKIT_BACKEND_1, [polkit-backend-1 >= 0.92])
+AC_SUBST(POLKIT_BACKEND_1_CFLAGS)
+AC_SUBST(POLKIT_BACKEND_1_LIBS)
+
 PKG_CHECK_MODULES(LIBPARTED, [libparted >= 1.8.8])
 AC_SUBST(LIBPARTED_CFLAGS)
 AC_SUBST(LIBPARTED_LIBS)
@@ -182,11 +180,11 @@ AC_SUBST(slashlibdir)
 AC_SUBST(slashsbindir)
 
 # ********************
-# Internationalisation
+# Internationalization
 # ********************
 
 IT_PROG_INTLTOOL([0.36.0])
-GETTEXT_PACKAGE=DeviceKit
+GETTEXT_PACKAGE=DeviceKit-disks
 AC_SUBST([GETTEXT_PACKAGE])
 AM_GLIB_GNU_GETTEXT
 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
index b72d517..b6d2833 100644 (file)
@@ -1,4 +1,3 @@
 # please keep this list sorted alphabetically
 #
-
-
+da
index ec619a0..46071e2 100644 (file)
@@ -2,3 +2,4 @@
 # Please keep this file sorted alphabetically.
 [encoding: UTF-8]
 policy/org.freedesktop.devicekit.disks.policy.in
+src/devkit-disks-polkit-action-lookup.c
diff --git a/po/da.po b/po/da.po
new file mode 100644 (file)
index 0000000..39736ab
--- /dev/null
+++ b/po/da.po
@@ -0,0 +1,216 @@
+# Danish translations for DeviceKit-disks.
+# Copyright (C) 2009 Red Hat, Inc.
+# This file is distributed under the same license as the DeviceKit-disks package.
+# David Zeuthen <davidz@redhat.com>, 2009.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: DeviceKit-disks\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-05-12 18:09-0400\n"
+"PO-Revision-Date: 2009-05-12 17:01-0400\n"
+"Last-Translator: David Zeuthen <davidz@redhat.com>\n"
+"Language-Team: Danish <dansk@dansk-gruppen.dk>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:1
+msgid "Authentication is required to cancel a job initiated by another user"
+msgstr ""
+"Autorisering er påkrævet for at afbryde et job påbegyndt af en anden bruger"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:2
+msgid "Authentication is required to check the file system on the device"
+msgstr "Autorisering er påkrævet for at checke fil systemet på en enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:3
+msgid "Authentication is required to configure Linux Software RAID devices"
+msgstr "Autorisering er påkrævet for at konfigurere RAID enheder"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:4
+msgid "Authentication is required to eject media from the device"
+msgstr "Autorisering er påkrævet for at skubbe medie ud af en enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:5
+msgid "Authentication is required to inhibit media detection"
+msgstr "Autorisering er påkrævet for at undertrykke medie detektion"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:6
+msgid "Authentication is required to list open files on a mounted file system"
+msgstr "Autorisering er påkrævet for at liste åbne filer"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:7
+msgid ""
+"Authentication is required to lock an encrypted device unlocked by another "
+"user"
+msgstr ""
+"Autorisering er påkrævet for at låse en krypteret enhed åbnet af en anden "
+"bruger"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:8
+msgid "Authentication is required to modify the device"
+msgstr "Autorisering er påkrævet for at ændre en enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:9
+msgid "Authentication is required to mount the device"
+msgstr "Autorisering er påkrævet for at montere et fil system"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:10
+msgid "Authentication is required to refresh ATA SMART data"
+msgstr "Autorisering er påkrævet for at læse ATA SMART data"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:11
+msgid "Authentication is required to retrieve historical ATA SMART data"
+msgstr "Autorisering er påkrævet for at hente historisk ATA SMART data"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:12
+msgid "Authentication is required to run ATA SMART self tests"
+msgstr "Autorisering er påkrævet for at køre ATA SMART selvcheck"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:13
+msgid "Authentication is required to unlock an encrypted device"
+msgstr "Autorisering er påkrævet for at åbne en krypteret enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:14
+msgid "Authentication is required to unmount devices mounted by another user"
+msgstr ""
+"Autorisering er påkrævet for at afmontere enheder monteret af en anden bruger"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:15
+msgid "Cancel a job initiated by another user"
+msgstr "Afbryd job påbegyndt af en anden bruger"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:16
+msgid "Check file system of a system-internal device"
+msgstr "Check fil system for en intern enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:17
+msgid "Check file system on a device"
+msgstr "Check fil system for en enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:18
+msgid "Configure Linux Software RAID"
+msgstr "Konfigurér Software RAID"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:19
+msgid "Eject a device"
+msgstr "Skub media ud af en enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:20
+msgid "Inhibit media detection"
+msgstr "Undertryk medie detektion"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:21
+msgid "List open files"
+msgstr "Vis åbne filer"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:22
+msgid "List open files on a system-internal device"
+msgstr "Vis åbne filer på en intern enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:23
+msgid "Lock an encrypted device unlocked by another user"
+msgstr "Lås en krypteret enhed åbnet af en anden bruger"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:24
+msgid "Modify a device"
+msgstr "Modificér en enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:25
+msgid "Modify a system-internal device"
+msgstr "Modificér en intern enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:26
+msgid "Mount a device"
+msgstr "Montér en enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:27
+msgid "Mount a system-internal device"
+msgstr "Montér en intern enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:28
+msgid "Refresh ATA SMART data"
+msgstr "Læs ATA SMART data"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:29
+msgid "Retrieve historical ATA SMART data"
+msgstr "Hent historisk ATA SMART data"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:30
+msgid "Run ATA SMART Self Tests"
+msgstr "Kør ATA SMART selv checks"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:31
+msgid "Unlock an encrypted device"
+msgstr "Åbn en krypteret enhed"
+
+#: ../policy/org.freedesktop.devicekit.disks.policy.in.h:32
+msgid "Unmount a device mounted by another user"
+msgstr "Afmontér en enhed monteret af en anden bruger"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:94
+msgid "Authentication is required to delete a partition"
+msgstr "Autorisering er påkrævet for at slette en partition"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:98
+msgid "Authentication is required to create a filesystem"
+msgstr "Autorisering er påkrævet for at skabe et fil system"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:102
+msgid "Authentication is required to create a partition"
+msgstr "Autorisering er påkrævet for at skabe en partition"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:106
+msgid "Authentication is required to modify a partition"
+msgstr "Autorisering er påkrævet for at ændre en partition"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:110
+msgid "Authentication is required to create a partition table"
+msgstr "Autorisering er påkrævet for at skabe en partition tabel"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:114
+msgid "Authentication is required to set the file system label"
+msgstr "Autorisering er påkrævet for at sætte fil system mærkat"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:118
+msgid "Authentication is required to stop a Software RAID device"
+msgstr "Autorisering er påkrævet for at stoppen en RAID enhed"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:122
+msgid ""
+"Authentication is required to add a new component to a Software RAID device"
+msgstr ""
+"Autorisering er påkrævet for at tilføje en ny komponent til en RAID enhed"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:126
+msgid ""
+"Authentication is required to remove a component from a Software RAID device"
+msgstr "Autorisering er påkrævet for at fjerne en komponent fra en RAID enhed"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:130
+msgid "Authentication is required to start a Software RAID device"
+msgstr "Autorisering er påkrævet for starte en RAID enhed"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:134
+msgid "Authentication is required to inhibit polling on a drive"
+msgstr ""
+"Autorisering er påkrævet for at undertrykke medie detektion for et drev"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:138
+msgid "Authentication is required to poll for media"
+msgstr "Autorisering er påkrævet for at tjekke medie"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:142
+msgid "Authentication is required to inhibit all drive polling"
+msgstr "Autorisering er påkrævet for at undertrykke al medie detektion"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:212
+msgid "Device"
+msgstr "Enhed"
+
+#: ../src/devkit-disks-polkit-action-lookup.c:231
+msgid "Drive"
+msgstr "Drev"
index e399c54..ffd0968 100644 (file)
@@ -25,7 +25,7 @@
     <defaults>
       <allow_any>no</allow_any>
       <allow_inactive>no</allow_inactive>
-      <allow_active>auth_admin</allow_active>
+      <allow_active>auth_admin_keep</allow_active>
     </defaults>
   </action>
 
@@ -45,7 +45,7 @@
     <defaults>
       <allow_any>no</allow_any>
       <allow_inactive>no</allow_inactive>
-      <allow_active>auth_admin</allow_active>
+      <allow_active>auth_admin_keep</allow_active>
     </defaults>
   </action>
 
@@ -75,7 +75,7 @@
     <defaults>
       <allow_any>no</allow_any>
       <allow_inactive>no</allow_inactive>
-      <allow_active>auth_admin</allow_active>
+      <allow_active>auth_admin_keep</allow_active>
     </defaults>
   </action>
 
     <defaults>
       <allow_any>no</allow_any>
       <allow_inactive>no</allow_inactive>
-      <allow_active>auth_admin</allow_active>
+      <allow_active>auth_admin_keep</allow_active>
     </defaults>
   </action>
 
     <defaults>
       <allow_any>no</allow_any>
       <allow_inactive>no</allow_inactive>
-      <allow_active>auth_admin</allow_active>
+      <allow_active>auth_admin_keep</allow_active>
     </defaults>
   </action>
 
index 38d3b97..56d9b58 100644 (file)
@@ -172,6 +172,33 @@ $(dbusconf_DATA): $(dbusconf_in_files) Makefile
 udevrulesdir = $(slashlibdir)/udev/rules.d
 udevrules_DATA = 95-devkit-disks.rules
 
+# ----------------------------------------------------------------------------------------------------
+
+polkitmodulesdir = $(libdir)/polkit-1/backends
+polkitmodules_LTLIBRARIES = libpolkit-devkit-disks-action-lookup.la
+
+libpolkit_devkit_disks_action_lookup_la_SOURCES =                      \
+       devkit-disks-polkit-action-lookup.c                             \
+        $(NULL)
+
+libpolkit_devkit_disks_action_lookup_la_CFLAGS =                        \
+        -DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE                \
+        -DG_LOG_DOMAIN=\"DeviceKit-Disks-Action-Lookup\"               \
+       $(POLKIT_BACKEND_1_CFLAGS)                                      \
+        $(NULL)
+
+libpolkit_devkit_disks_action_lookup_la_LDFLAGS =                       \
+       -export_dynamic -avoid-version -module -no-undefined            \
+       -export-symbols-regex '^g_io_module_(load|unload)'              \
+       $(POLKIT_BACKEND_1_LIBS)                                        \
+        $(NULL)
+
+libpolkit_devkit_disks_action_lookup_la_LIBADD =                       \
+        $(NULL)
+
+
+# ----------------------------------------------------------------------------------------------------
+
 CLEANFILES = $(BUILT_SOURCES)
 
 EXTRA_DIST = org.freedesktop.DeviceKit.Disks.xml        \
index bc6e65f..9a0be35 100644 (file)
@@ -436,349 +436,3 @@ devkit_disks_ata_smart_db_get_entries (DevkitDisksAtaSmartDb              *db,
         return ret;
 }
 
-#if 0
-void
-devkit_disks_ata_smart_db_record_smart_values (DevkitDisksAtaSmartDb *ata_smart_db,
-                                         DevkitDisksDevice *device)
-{
-        int n;
-        int ret;
-        char *err_msg;
-        char *s;
-        char *disk_id;
-        sqlite3_int64 row_id;
-        GString *str;
-
-        g_return_if_fail (device != NULL);
-        g_return_if_fail (ata_smart_db != NULL);
-        g_return_if_fail (ata_smart_db->priv->db != NULL);
-
-        disk_id = NULL;
-
-        disk_id = drive_get_safe_uuid (device);
-        if (disk_id == NULL) {
-                g_warning ("no drive uuid for %s", device->priv->native_path);
-                goto out;
-        }
-
-        s = sqlite3_mprintf (
-                "BEGIN TRANSACTION;"
-                "INSERT INTO SmartEntry "
-                "(disk_id, time_collected, temperature, time_powered_on, last_self_test_result, is_failing) "
-                "VALUES ('%q', %" G_GUINT64_FORMAT ", %d, %" G_GUINT64_FORMAT ", '%q', %d)",
-                disk_id,
-                device->priv->drive_smart_time_collected,
-                (int) device->priv->drive_smart_temperature,
-                device->priv->drive_smart_time_powered_on,
-                device->priv->drive_smart_last_self_test_result,
-                device->priv->drive_smart_is_failing ? 1 : 0);
-        ret = sqlite3_exec (ata_smart_db->priv->db, s, NULL, NULL, &err_msg);
-        sqlite3_free (s);
-        if (ret != SQLITE_OK) {
-                g_warning ("SQL error: %s", err_msg);
-                sqlite3_free (err_msg);
-                goto out;
-        }
-
-        row_id = sqlite3_last_insert_rowid (ata_smart_db->priv->db);
-
-        str = g_string_new (NULL);
-        for (n = 0; n < (int) device->priv->drive_smart_attributes->len; n++) {
-                GValue elem = {0};
-                int id;
-                char *name;
-                int flags;
-                int value;
-                int worst;
-                int threshold;
-                char *raw_string;
-
-                g_value_init (&elem, SMART_DATA_STRUCT_TYPE);
-                g_value_set_static_boxed (&elem, device->priv->drive_smart_attributes->pdata[n]);
-                dbus_g_type_struct_get (&elem,
-                                        0, &id,
-                                        1, &name,
-                                        2, &flags,
-                                        3, &value,
-                                        4, &worst,
-                                        5, &threshold,
-                                        6, &raw_string,
-                                        G_MAXUINT);
-
-                s = sqlite3_mprintf (
-                        "INSERT INTO SmartAttr "
-                        "VALUES (%" G_GINT64_FORMAT ", '%q', %" G_GUINT64_FORMAT ", %d, '%q', %d, %d, %d, %d, '%q');\n",
-                        row_id,
-                        disk_id,
-                        device->priv->drive_smart_time_collected,
-                        id,
-                        name,
-                        flags,
-                        value,
-                        worst,
-                        threshold,
-                        raw_string);
-                g_string_append (str, s);
-                sqlite3_free (s);
-        }
-
-        g_string_append_printf (str, "COMMIT;");
-
-        s = g_string_free (str, FALSE);
-        ret = sqlite3_exec (ata_smart_db->priv->db, s, NULL, NULL, &err_msg);
-        g_free (s);
-        if (ret != SQLITE_OK) {
-                g_warning ("SQL error: %s", err_msg);
-                sqlite3_free (err_msg);
-        }
-out:
-        g_free (disk_id);
-}
-
-static gboolean
-throw_error (DBusGMethodInvocation *context, int error_code, const char *format, ...)
-{
-        GError *error;
-        va_list args;
-        char *message;
-
-        if (context == NULL)
-                return TRUE;
-
-        va_start (args, format);
-        message = g_strdup_vprintf (format, args);
-        va_end (args);
-
-        error = g_error_new (DEVKIT_DISKS_ERROR,
-                             error_code,
-                             "%s", message);
-        dbus_g_method_return_error (context, error);
-        g_error_free (error);
-        g_free (message);
-        return TRUE;
-}
-
-typedef struct {
-        GPtrArray *array;
-
-        gint64 cur_rowid;
-        gboolean needs_draining;
-
-        guint64 time_collected;
-        double temperature;
-        guint64 time_powered_on;
-        char last_self_test_result[256];
-        gboolean is_failing;
-        GPtrArray *attrs;
-} HistoricalData;
-
-static void
-historical_data_drain (HistoricalData *data)
-{
-        GValue elem = {0};
-
-        if (!data->needs_draining)
-                return;
-
-        g_value_init (&elem, HISTORICAL_SMART_DATA_STRUCT_TYPE);
-        g_value_take_boxed (&elem, dbus_g_type_specialized_construct (HISTORICAL_SMART_DATA_STRUCT_TYPE));
-        dbus_g_type_struct_set (&elem,
-                                0, data->time_collected,
-                                1, data->temperature,
-                                2, data->time_powered_on,
-                                3, data->last_self_test_result,
-                                4, data->is_failing,
-                                5, data->attrs,
-                                G_MAXUINT);
-        g_ptr_array_add (data->array, g_value_get_boxed (&elem));
-
-        g_ptr_array_foreach (data->attrs, (GFunc) g_value_array_free, NULL);
-        g_ptr_array_free (data->attrs, TRUE);
-        data->attrs = NULL;
-        data->needs_draining = FALSE;
-}
-
-static int
-historical_data_cb (void *user_data, int argc, char **argv, char **col_name)
-{
-        HistoricalData *data = (HistoricalData *) user_data;
-        gint64 rowid;
-        int id;
-        const char *name;
-        int flags;
-        int value;
-        int worst;
-        int threshold;
-        const char *raw;
-
-        if (argc != 13) {
-                g_warning ("expected 13 columns, got %d instead", argc);
-                goto out;
-        }
-
-        /* TODO: could add checks for the column types */
-
-        rowid = atoll (argv[0]);
-        if (rowid != data->cur_rowid) {
-                if (data->needs_draining) {
-                        historical_data_drain (data);
-                }
-
-                data->needs_draining = TRUE;
-                data->cur_rowid = rowid;
-                data->time_collected = atoll (argv[1]);
-                data->temperature = atof (argv[2]);
-                data->time_powered_on = atoll (argv[3]);
-                strncpy (data->last_self_test_result, argv[4], 256);
-                data->is_failing = (strcmp (argv[5], "0") != 0);
-                data->attrs = g_ptr_array_new ();
-
-                /*g_warning ("got time_collected=%lld temperature=%g time_powered_on=%lld lstr='%s' is_failing=%d",
-                           data->time_collected,
-                           data->temperature,
-                           data->time_powered_on,
-                           data->last_self_test_result,
-                           data->is_failing);*/
-        }
-
-        id = atoi (argv[6]);
-        name = argv[7];
-        flags = atoi (argv[8]);
-        value = atoi (argv[9]);
-        worst = atoi (argv[10]);
-        threshold = atoi (argv[11]);
-        raw = argv[12];
-
-        /*g_warning ("got id=%d name='%s' flags=0x%04x value=%d worst=%d threshold=%d raw='%s'",
-          id, name, flags, value, worst, threshold, raw);*/
-
-        GValue elem = {0};
-        g_value_init (&elem, SMART_DATA_STRUCT_TYPE);
-        g_value_take_boxed (&elem, dbus_g_type_specialized_construct (SMART_DATA_STRUCT_TYPE));
-        dbus_g_type_struct_set (&elem,
-                                0, id,
-                                1, name,
-                                2, flags,
-                                3, value,
-                                4, worst,
-                                5, threshold,
-                                6, raw,
-                                G_MAXUINT);
-        g_ptr_array_add (data->attrs, g_value_get_boxed (&elem));
-
-
-        /*
-        int n;
-        for (n = 0; n < argc; n++) {
-                printf ("%s = %s\n", col_name[n], argv[n] ? argv[n] : "NULL");
-        }
-        printf("\n");
-        */
-
-out:
-        return 0;
-}
-
-gboolean
-devkit_disks_device_drive_smart_get_historical_data (DevkitDisksDevice     *device,
-                                                     guint64                from,
-                                                     guint64                to,
-                                                     DBusGMethodInvocation *context)
-{
-        char *s;
-        char *disk_id;
-        GTimeVal now;
-        int ret;
-        char *err_msg;
-        DevkitDisksAtaSmartDb *ata_smart_db;
-        HistoricalData *data;
-        PolKitCaller *pk_caller;
-
-        disk_id = NULL;
-        pk_caller = NULL;
-
-        if (context != NULL) {
-                if ((pk_caller = devkit_disks_damon_local_get_caller_for_context (device->priv->daemon,
-                                                                                  context)) == NULL)
-                        goto out;
-        }
-
-        if (context != NULL) {
-                if (!devkit_disks_damon_local_check_auth (
-                            device->priv->daemon,
-                            pk_caller,
-                            "org.freedesktop.devicekit.disks.drive-smart-retrieve-historical-data",
-                            context)) {
-                        goto out;
-                }
-        }
-
-        ata_smart_db = devkit_disks_daemon_local_get_ata_smart_db (device->priv->daemon);
-
-        disk_id = drive_get_safe_uuid (device);
-        if (disk_id == NULL) {
-                g_warning ("no drive uuid for %s", device->priv->native_path);
-                throw_error (context, DEVKIT_DISKS_ERROR_FAILED, "No unique disk id for device");
-                goto out;
-        }
-
-        if (from > to) {
-                throw_error (context, DEVKIT_DISKS_ERROR_FAILED, "Malformed time range (from > to)");
-                goto out;
-        }
-
-        if (to == 0) {
-                g_get_current_time (&now);
-                to = (guint64) now.tv_sec;
-        }
-
-        data = g_new0 (HistoricalData, 1);
-        data->array = g_ptr_array_new ();
-        data->cur_rowid = -1;
-
-        s = sqlite3_mprintf ("SELECT"
-                             " SmartEntry.smart_entry_id,"
-                             " SmartEntry.time_collected,"
-                             " SmartEntry.temperature,"
-                             " SmartEntry.time_powered_on,"
-                             " SmartEntry.last_self_test_result,"
-                             " SmartEntry.is_failing,"
-                             " SmartAttr.id,"
-                             " SmartAttr.name,"
-                             " Smartattr.flags, "
-                             " SmartAttr.value,"
-                             " SmartAttr.worst,"
-                             " SmartAttr.threshold,"
-                             " SmartAttr.raw "
-                             "FROM SmartEntry, SmartAttr "
-                             "WHERE"
-                             " SmartEntry.disk_id='%q' AND"
-                             " SmartEntry.smart_entry_id=SmartAttr.smart_entry_id AND"
-                             " SmartEntry.time_collected >= %" G_GUINT64_FORMAT " AND"
-                             " SmartEntry.time_collected <= %" G_GUINT64_FORMAT " "
-                             "ORDER BY SmartEntry.smart_entry_id, SmartAttr.id;",
-                             disk_id, from, to);
-        ret = sqlite3_exec (ata_smart_db->priv->db,
-                            s,
-                            historical_data_cb,
-                            data,
-                            &err_msg);
-        if (ret != SQLITE_OK) {
-                g_warning ("SQL error: %s", err_msg);
-                sqlite3_free (err_msg);
-        }
-        sqlite3_free (s);
-
-        historical_data_drain (data);
-        dbus_g_method_return (context, data->array);
-        g_ptr_array_foreach (data->array, (GFunc) g_value_array_free, NULL);
-        g_ptr_array_free (data->array, TRUE);
-        g_free (data);
-
-out:
-        g_free (disk_id);
-        if (pk_caller != NULL)
-                polkit_caller_unref (pk_caller);
-        return TRUE;
-}
-#endif
index 2460e7a..dbdfa48 100644 (file)
@@ -1353,6 +1353,7 @@ void
 devkit_disks_daemon_local_check_auth (DevkitDisksDaemon            *daemon,
                                       DevkitDisksDevice            *device,
                                       const gchar                  *action_id,
+                                      const gchar                  *operation,
                                       DevkitDisksCheckAuthCallback  check_auth_callback,
                                       DBusGMethodInvocation        *context,
                                       guint                         num_user_data,
@@ -1385,6 +1386,77 @@ devkit_disks_daemon_local_check_auth (DevkitDisksDaemon            *daemon,
 
         if (action_id != NULL) {
                 PolkitSubject *subject;
+                GHashTable *details;
+                gchar partition_number_buf[32];
+
+                /* Set details - see devkit-disks-polkit-action-lookup.c for where
+                 * these key/value pairs are used
+                 */
+                details = g_hash_table_new (g_str_hash, g_str_equal);
+                if (operation != NULL) {
+                        g_hash_table_insert (details,
+                                             "operation",
+                                             (gpointer) operation);
+                }
+                if (device != NULL) {
+                        DevkitDisksDevice *drive;
+
+                        g_hash_table_insert (details,
+                                             "unix-device",
+                                             device->priv->device_file);
+                        if (device->priv->device_file_by_id->len > 0)
+                                g_hash_table_insert (details,
+                                                     "unix-device-by-id",
+                                                     device->priv->device_file_by_id->pdata[0]);
+                        if (device->priv->device_file_by_path->len > 0)
+                                g_hash_table_insert (details,
+                                                     "unix-device-by-path",
+                                                     device->priv->device_file_by_path->pdata[0]);
+
+                        if (device->priv->device_is_drive) {
+                                drive = device;
+                        } else if (device->priv->device_is_partition) {
+                                g_hash_table_insert (details, "is-partition", "1");
+                                g_snprintf (partition_number_buf,
+                                            sizeof partition_number_buf,
+                                            "%d",
+                                            device->priv->partition_number);
+                                g_hash_table_insert (details, "partition-number", partition_number_buf);
+                                drive = devkit_disks_daemon_local_find_by_object_path (device->priv->daemon,
+                                                                                       device->priv->partition_slave);
+                        } else {
+                                drive = NULL;
+                        }
+
+                        if (drive != NULL) {
+                                g_hash_table_insert (details,
+                                                     "drive-unix-device",
+                                                     drive->priv->device_file);
+                                if (drive->priv->device_file_by_id->len > 0)
+                                        g_hash_table_insert (details,
+                                                             "drive-unix-device-by-id",
+                                                             drive->priv->device_file_by_id->pdata[0]);
+                                if (drive->priv->device_file_by_path->len > 0)
+                                        g_hash_table_insert (details,
+                                                             "drive-unix-device-by-path",
+                                                             drive->priv->device_file_by_path->pdata[0]);
+                                g_hash_table_insert (details,
+                                                     "drive-vendor",
+                                                     drive->priv->drive_vendor);
+                                g_hash_table_insert (details,
+                                                     "drive-model",
+                                                     drive->priv->drive_model);
+                                g_hash_table_insert (details,
+                                                     "drive-revision",
+                                                     drive->priv->drive_revision);
+                                g_hash_table_insert (details,
+                                                     "drive-serial",
+                                                     drive->priv->drive_serial);
+                                g_hash_table_insert (details,
+                                                     "drive-connection-interface",
+                                                     drive->priv->drive_connection_interface);
+                        }
+                }
 
                 subject = polkit_system_bus_name_new (dbus_g_method_get_sender (context));
 
@@ -1397,12 +1469,14 @@ devkit_disks_daemon_local_check_auth (DevkitDisksDaemon            *daemon,
                 polkit_authority_check_authorization (daemon->priv->authority,
                                                       subject,
                                                       action_id,
+                                                      details,
                                                       POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
                                                       data->cancellable,
                                                       (GAsyncReadyCallback) lca_check_authorization_callback,
                                                       data);
 
                 g_object_unref (subject);
+                g_hash_table_unref (details);
         } else {
                 data->check_auth_callback (data->daemon,
                                            data->device,
@@ -1600,6 +1674,7 @@ devkit_disks_daemon_drive_inhibit_all_polling (DevkitDisksDaemon     *daemon,
         devkit_disks_daemon_local_check_auth (daemon,
                                               NULL,
                                               "org.freedesktop.devicekit.disks.inhibit-polling",
+                                              "InhibitAllPolling",
                                               devkit_disks_daemon_drive_inhibit_all_polling_authorized_cb,
                                               context,
                                               1,
index 51cd0aa..5dbefd9 100644 (file)
@@ -102,6 +102,7 @@ typedef void (*DevkitDisksCheckAuthCallback) (DevkitDisksDaemon     *daemon,
 void               devkit_disks_daemon_local_check_auth          (DevkitDisksDaemon            *daemon,
                                                                   DevkitDisksDevice            *device,
                                                                   const gchar                  *action_id,
+                                                                  const gchar                  *operation,
                                                                   DevkitDisksCheckAuthCallback  check_auth_callback,
                                                                   DBusGMethodInvocation        *context,
                                                                   guint                         num_user_data,
index 21b07b0..87630f3 100644 (file)
@@ -4630,6 +4630,7 @@ devkit_disks_device_filesystem_mount (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               action_id,
+                                              "FilesystemMount",
                                               devkit_disks_device_filesystem_mount_authorized_cb,
                                               context,
                                               2,
@@ -4793,6 +4794,7 @@ devkit_disks_device_filesystem_unmount (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               action_id,
+                                              "FilesystemUnmount",
                                               devkit_disks_device_filesystem_unmount_authorized_cb,
                                               context,
                                               1,
@@ -4965,6 +4967,7 @@ devkit_disks_device_filesystem_list_open_files (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                               "org.freedesktop.devicekit.disks.filesystem-lsof-system-internal" :
                                               "org.freedesktop.devicekit.disks.filesystem-lsof",
+                                              "FilesystemListOpenFiles",
                                               devkit_disks_device_filesystem_list_open_files_authorized_cb,
                                               context,
                                               0);
@@ -5086,6 +5089,7 @@ devkit_disks_device_drive_eject (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.drive-eject",
+                                              "DriveEject",
                                               devkit_disks_device_drive_eject_authorized_cb,
                                               context,
                                               1,
@@ -5189,6 +5193,7 @@ devkit_disks_device_filesystem_check (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                               "org.freedesktop.devicekit.disks.filesystem-check-system-internal" :
                                               "org.freedesktop.devicekit.disks.filesystem-check",
+                                              "FilesystemCheck",
                                               devkit_disks_device_filesystem_check_authorized_cb,
                                               context,
                                               1,
@@ -5331,6 +5336,7 @@ devkit_disks_device_partition_delete (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                               "org.freedesktop.devicekit.disks.change-system-internal" :
                                               "org.freedesktop.devicekit.disks.change",
+                                              "PartitionDelete",
                                               devkit_disks_device_partition_delete_authorized_cb,
                                               context,
                                               1,
@@ -5696,6 +5702,7 @@ devkit_disks_device_filesystem_create (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                                 "org.freedesktop.devicekit.disks.change-system-internal" :
                                                 "org.freedesktop.devicekit.disks.change",
+                                              "FilesystemCreate",
                                               devkit_disks_device_filesystem_create_authorized_cb,
                                               context,
                                               2,
@@ -5768,6 +5775,7 @@ devkit_disks_device_job_cancel (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               action_id,
+                                              "JobCancel",
                                               devkit_disks_device_job_cancel_authorized_cb,
                                               context,
                                               0);
@@ -6107,6 +6115,7 @@ devkit_disks_device_partition_create (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                                 "org.freedesktop.devicekit.disks.change-system-internal" :
                                                 "org.freedesktop.devicekit.disks.change",
+                                              "PartitionCreate",
                                               devkit_disks_device_partition_create_authorized_cb,
                                               context,
                                               8,
@@ -6315,6 +6324,7 @@ devkit_disks_device_partition_modify (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                                 "org.freedesktop.devicekit.disks.change-system-internal" :
                                                 "org.freedesktop.devicekit.disks.change",
+                                              "PartitionModify",
                                               devkit_disks_device_partition_modify_authorized_cb,
                                               context,
                                               3,
@@ -6430,6 +6440,7 @@ devkit_disks_device_partition_table_create (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                                 "org.freedesktop.devicekit.disks.change-system-internal" :
                                                 "org.freedesktop.devicekit.disks.change",
+                                              "PartitionTableCreate",
                                               devkit_disks_device_partition_table_create_authorized_cb,
                                               context,
                                               2,
@@ -6767,6 +6778,7 @@ devkit_disks_device_luks_unlock (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.luks-unlock",
+                                              "LuksUnlock",
                                               devkit_disks_device_luks_unlock_authorized_cb,
                                               context,
                                               2,
@@ -7064,6 +7076,7 @@ devkit_disks_device_luks_lock (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               action_id,
+                                              "LuksLock",
                                               devkit_disks_device_luks_lock_authorized_cb,
                                               context,
                                               1,
@@ -7175,6 +7188,7 @@ devkit_disks_device_luks_change_passphrase (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                                 "org.freedesktop.devicekit.disks.change-system-internal" :
                                                 "org.freedesktop.devicekit.disks.change",
+                                              "LuksChangePassphrase",
                                               devkit_disks_device_luks_change_passphrase_authorized_cb,
                                               context,
                                               2,
@@ -7322,6 +7336,7 @@ devkit_disks_device_filesystem_set_label (DevkitDisksDevice     *device,
                                               device->priv->device_is_system_internal ?
                                                 "org.freedesktop.devicekit.disks.change-system-internal" :
                                                 "org.freedesktop.devicekit.disks.change",
+                                              "FilesystemSetLabel",
                                               devkit_disks_device_filesystem_set_label_authorized_cb,
                                               context,
                                               1,
@@ -7694,6 +7709,7 @@ devkit_disks_device_drive_ata_smart_refresh_data (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               action_id,
+                                              "DriveAtaSmartRefreshData",
                                               devkit_disks_device_drive_ata_smart_refresh_data_authorized_cb,
                                               context,
                                               1,
@@ -7821,6 +7837,7 @@ devkit_disks_device_drive_ata_smart_get_historical_data (DevkitDisksDevice     *
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.drive-ata-smart-retrieve-historical-data",
+                                              "DriveAtaSmartGetHistoricalData",
                                               devkit_disks_device_drive_ata_smart_get_historical_data_authorized_cb,
                                               context,
                                               3,
@@ -7921,6 +7938,7 @@ devkit_disks_device_drive_ata_smart_initiate_selftest (DevkitDisksDevice     *de
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.drive-ata-smart-selftest",
+                                              "DriveAtaSmartInitiateSelftest",
                                               devkit_disks_device_drive_ata_smart_initiate_selftest_authorized_cb,
                                               context,
                                               2,
@@ -8017,6 +8035,7 @@ devkit_disks_device_linux_md_stop (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.linux-md",
+                                              "LinuxMdStop",
                                               devkit_disks_device_linux_md_stop_authorized_cb,
                                               context,
                                               1,
@@ -8142,6 +8161,7 @@ devkit_disks_device_linux_md_add_component (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.linux-md",
+                                              "LinuxMdAddComponent",
                                               devkit_disks_device_linux_md_add_component_authorized_cb,
                                               context,
                                               2,
@@ -8386,6 +8406,7 @@ devkit_disks_device_linux_md_remove_component (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.linux-md",
+                                              "LinuxMdRemoveComponent",
                                               devkit_disks_device_linux_md_remove_component_authorized_cb,
                                               context,
                                               2,
@@ -8711,6 +8732,7 @@ devkit_disks_daemon_linux_md_start (DevkitDisksDaemon     *daemon,
         devkit_disks_daemon_local_check_auth (daemon,
                                               NULL,
                                               "org.freedesktop.devicekit.disks.linux-md",
+                                              "LinuxMdStart",
                                               devkit_disks_daemon_linux_md_start_authorized_cb,
                                               context,
                                               2,
@@ -9070,6 +9092,7 @@ devkit_disks_device_drive_inhibit_polling (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.inhibit-polling",
+                                              "DriveInhibitPolling",
                                               devkit_disks_device_drive_inhibit_polling_authorized_cb,
                                               context,
                                               1,
@@ -9153,6 +9176,7 @@ devkit_disks_device_drive_poll_media (DevkitDisksDevice     *device,
         devkit_disks_daemon_local_check_auth (device->priv->daemon,
                                               device,
                                               "org.freedesktop.devicekit.disks.inhibit-polling",
+                                              "DrivePollMedia",
                                               devkit_disks_device_drive_poll_media_authorized_cb,
                                               context,
                                               0);
diff --git a/src/devkit-disks-polkit-action-lookup.c b/src/devkit-disks-polkit-action-lookup.c
new file mode 100644 (file)
index 0000000..6937131
--- /dev/null
@@ -0,0 +1,279 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#include "config.h"
+
+#include <polkitbackend/polkitbackend.h>
+
+#include <glib/gi18n-lib.h>
+
+#define DEVKIT_DISKS_TYPE_ACTION_LOOKUP          (devkit_disks_action_lookup_get_type())
+#define DEVKIT_DISKS_ACTION_LOOKUP(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), DEVKIT_DISKS_TYPE_ACTION_LOOKUP, DevkitDisksActionLookup))
+#define DEVKIT_DISKS_ACTION_LOOKUP_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), DEVKIT_DISKS_TYPE_ACTION_LOOKUP, DevkitDisksActionLookupClass))
+#define DEVKIT_DISKS_ACTION_LOOKUP_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), DEVKIT_DISKS_TYPE_ACTION_LOOKUP, DevkitDisksActionLookupClass))
+#define DEVKIT_DISKS_IS_ACTION_LOOKUP(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), DEVKIT_DISKS_TYPE_ACTION_LOOKUP))
+#define DEVKIT_DISKS_IS_ACTION_LOOKUP_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), DEVKIT_DISKS_TYPE_ACTION_LOOKUP))
+
+typedef struct _DevkitDisksActionLookup DevkitDisksActionLookup;
+typedef struct _DevkitDisksActionLookupClass DevkitDisksActionLookupClass;
+
+struct _DevkitDisksActionLookup
+{
+        GObject parent;
+};
+
+struct _DevkitDisksActionLookupClass
+{
+        GObjectClass parent_class;
+};
+
+GType           devkit_disks_action_lookup_get_type     (void) G_GNUC_CONST;
+
+static void polkit_backend_action_lookup_iface_init (PolkitBackendActionLookupIface *iface);
+
+#define _G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init)                                                \
+{                                                                                                             \
+        const GInterfaceInfo g_implement_interface_info = {                                                   \
+                (GInterfaceInitFunc) iface_init, NULL, NULL                                                   \
+        };                                                                                                    \
+        g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
+}
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (DevkitDisksActionLookup,
+                                devkit_disks_action_lookup,
+                                G_TYPE_OBJECT,
+                                0,
+                                _G_IMPLEMENT_INTERFACE_DYNAMIC (POLKIT_BACKEND_TYPE_ACTION_LOOKUP,
+                                                                polkit_backend_action_lookup_iface_init))
+
+static void
+devkit_disks_action_lookup_init (DevkitDisksActionLookup *lookup)
+{
+}
+
+static void
+devkit_disks_action_lookup_class_finalize (DevkitDisksActionLookupClass *klass)
+{
+}
+
+static void
+devkit_disks_action_lookup_class_init (DevkitDisksActionLookupClass *klass)
+{
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+typedef struct
+{
+        const gchar *name;
+        const gchar *message;
+} Map;
+
+static const Map map[] = {
+        {
+                "PartitionDelete",
+                N_("Authentication is required to delete a partition"),
+        },
+        {
+                "FilesystemCreate",
+                N_("Authentication is required to create a filesystem")
+        },
+        {
+                "PartitionCreate",
+                N_("Authentication is required to create a partition")
+        },
+        {
+                "PartitionModify",
+                N_("Authentication is required to modify a partition")
+        },
+        {
+                "PartitionTableCreate",
+                N_("Authentication is required to create a partition table")
+        },
+        {
+                "FilesystemSetLabel",
+                N_("Authentication is required to set the file system label")
+        },
+        {
+                "LinuxMdStop",
+                N_("Authentication is required to stop a Software RAID device")
+        },
+        {
+                "LinuxMdAddComponent",
+                N_("Authentication is required to add a new component to a Software RAID device")
+        },
+        {
+                "LinuxMdRemoveComponent",
+                N_("Authentication is required to remove a component from a Software RAID device")
+        },
+        {
+                "LinuxMdStart",
+                N_("Authentication is required to start a Software RAID device")
+        },
+        {
+                "DriveInhibitPolling",
+                N_("Authentication is required to inhibit polling on a drive")
+        },
+        {
+                "DrivePollMedia",
+                N_("Authentication is required to poll for media")
+        },
+        {
+                "InhibitAllPolling",
+                N_("Authentication is required to inhibit all drive polling")
+        },
+        {
+                NULL,
+                NULL,
+        }
+};
+
+
+static gchar *
+devkit_disks_action_lookup_get_message   (PolkitBackendActionLookup *lookup,
+                                          const gchar               *action_id,
+                                          GHashTable                *details,
+                                          PolkitActionDescription   *action_description)
+{
+        const gchar *operation;
+        gchar *ret;
+        guint n;
+
+        ret = NULL;
+
+        if (!g_str_has_prefix (action_id, "org.freedesktop.devicekit.disks."))
+                goto out;
+
+        operation = g_hash_table_lookup (details, "operation");
+        if (operation == NULL)
+                goto out;
+
+        for (n = 0; map[n].name != NULL; n++) {
+                if (g_strcmp0 (map[n].name, operation) != 0)
+                        continue;
+
+                ret = g_strdup (g_dgettext (GETTEXT_PACKAGE, map[n].message));
+                break;
+        }
+
+ out:
+        return ret;
+}
+
+static gchar *
+devkit_disks_action_lookup_get_icon_name (PolkitBackendActionLookup *lookup,
+                                          const gchar               *action_id,
+                                          GHashTable                *details,
+                                          PolkitActionDescription   *action_description)
+{
+        gchar *ret;
+
+        ret = NULL;
+
+        if (!g_str_has_prefix (action_id, "org.freedesktop.devicekit.disks."))
+                goto out;
+
+        /* explicitly left blank for now */
+
+ out:
+        return ret;
+}
+
+static GHashTable *
+devkit_disks_action_lookup_get_details   (PolkitBackendActionLookup *lookup,
+                                          const gchar               *action_id,
+                                          GHashTable                *details,
+                                          PolkitActionDescription   *action_description)
+{
+        const gchar *s;
+        const gchar *s2;
+        const gchar *s3;
+        GString *str;
+        GHashTable *ret;
+
+        if (!g_str_has_prefix (action_id, "org.freedesktop.devicekit.disks."))
+                return NULL;
+
+        ret = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
+
+        /* see devkit_disks_daemon_local_check_auth() in devkit-disks-daemon.c
+         * for where these keys are set
+         */
+
+        s = g_hash_table_lookup (details, "unix-device");
+        if (s != NULL)
+                g_hash_table_insert (ret, _("Device"), g_strdup (s));
+
+        s = g_hash_table_lookup (details, "drive-vendor");
+        s2 = g_hash_table_lookup (details, "drive-model");
+        s3 = g_hash_table_lookup (details, "drive-revision");
+        str = g_string_new (NULL);
+        if (s != NULL) {
+                g_string_append (str, s);
+        }
+        if (s2 != NULL) {
+                if (str->len > 0)
+                        g_string_append_c (str, ' ');
+                g_string_append (str, s2);
+        }
+        if (s3 != NULL) {
+                if (str->len > 0)
+                        g_string_append_c (str, ' ');
+                g_string_append_printf (str, "(%s)", s3);
+        }
+
+        if (str->len > 0) {
+                g_hash_table_insert (ret, _("Drive"), g_strdup (str->str));
+        }
+        g_string_free (str, TRUE);
+
+        return ret;
+}
+
+static void
+polkit_backend_action_lookup_iface_init (PolkitBackendActionLookupIface *iface)
+{
+        iface->get_message   = devkit_disks_action_lookup_get_message;
+        iface->get_icon_name = devkit_disks_action_lookup_get_icon_name;
+        iface->get_details   = devkit_disks_action_lookup_get_details;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+void
+g_io_module_load (GIOModule *module)
+{
+        bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+        devkit_disks_action_lookup_register_type (G_TYPE_MODULE (module));
+
+        g_io_extension_point_implement (POLKIT_BACKEND_ACTION_LOOKUP_EXTENSION_POINT_NAME,
+                                        DEVKIT_DISKS_TYPE_ACTION_LOOKUP,
+                                        "DeviceKit-disks action lookup extension " PACKAGE_VERSION,
+                                        0);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}