summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2012-04-23 16:45:25 -0400
committerDavid Zeuthen <davidz@redhat.com>2012-04-23 16:45:25 -0400
commite52eb24f6676a41fdb52c86236dec5cd775ef9c2 (patch)
tree6a4e483f840857073201f735ae004de43da6e023
parent4753220245872e41f72941579223efa1e63fd101 (diff)
Add separate polkit actions for ejecting media
It's a little weird to overload the modify-device action especially since this doesn't change any bits on the media. Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r--data/org.freedesktop.udisks2.policy.in37
-rw-r--r--src/udiskslinuxdrive.c7
2 files changed, 39 insertions, 5 deletions
diff --git a/data/org.freedesktop.udisks2.policy.in b/data/org.freedesktop.udisks2.policy.in
index c41e2ec..5ad2bbb 100644
--- a/data/org.freedesktop.udisks2.policy.in
+++ b/data/org.freedesktop.udisks2.policy.in
@@ -205,7 +205,42 @@
</action>
<!-- ###################################################################### -->
- <!-- Modify a device (create new filesystem, partitioning, change FS label, ejecting media, etc.) -->
+ <!-- Eject media from a drive -->
+
+ <action id="org.freedesktop.udisks2.eject-media">
+ <_description>Eject media</_description>
+ <_message>Authentication is required to eject media</_message>
+ <defaults>
+ <allow_any>auth_admin</allow_any>
+ <allow_inactive>auth_admin</allow_inactive>
+ <allow_active>yes</allow_active>
+ </defaults>
+ </action>
+
+ <!-- eject media from a drive considered a "system device" -->
+ <action id="org.freedesktop.udisks2.eject-media-system">
+ <_description>Eject media from a system drive</_description>
+ <_message>Authentication is required to eject media</_message>
+ <defaults>
+ <allow_any>auth_admin</allow_any>
+ <allow_inactive>auth_admin</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+
+ <!-- eject media from a drive attached to another seat -->
+ <action id="org.freedesktop.udisks2.eject-media-other-seat">
+ <_description>Eject media attached to another seat</_description>
+ <_message>Authentication is required to eject media from a drive plugged into another seat</_message>
+ <defaults>
+ <allow_any>auth_admin</allow_any>
+ <allow_inactive>auth_admin</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+
+ <!-- ###################################################################### -->
+ <!-- Modify a device (create new filesystem, partitioning, change FS label etc.) -->
<action id="org.freedesktop.udisks2.modify-device">
<_description>Modify a device</_description>
diff --git a/src/udiskslinuxdrive.c b/src/udiskslinuxdrive.c
index a89fe32..98f705b 100644
--- a/src/udiskslinuxdrive.c
+++ b/src/udiskslinuxdrive.c
@@ -729,16 +729,15 @@ handle_eject (UDisksDrive *_drive,
goto out;
}
- /* TODO: is it a good idea to overload modify-device? */
message = N_("Authentication is required to eject $(udisks2.device)");
- action_id = "org.freedesktop.udisks2.modify-device";
+ action_id = "org.freedesktop.udisks2.eject-media";
if (udisks_block_get_hint_system (block))
{
- action_id = "org.freedesktop.udisks2.modify-device-system";
+ action_id = "org.freedesktop.udisks2.eject-media-system";
}
else if (!udisks_daemon_util_on_same_seat (daemon, UDISKS_OBJECT (object), caller_pid))
{
- action_id = "org.freedesktop.udisks2.modify-device-other-seat";
+ action_id = "org.freedesktop.udisks2.eject-media-other-seat";
}
/* Check that the user is actually authorized */