From e52eb24f6676a41fdb52c86236dec5cd775ef9c2 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Mon, 23 Apr 2012 16:45:25 -0400 Subject: 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 --- data/org.freedesktop.udisks2.policy.in | 37 +++++++++++++++++++++++++++++++++- src/udiskslinuxdrive.c | 7 +++---- 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 @@ - + + + + <_description>Eject media + <_message>Authentication is required to eject media + + auth_admin + auth_admin + yes + + + + + + <_description>Eject media from a system drive + <_message>Authentication is required to eject media + + auth_admin + auth_admin + auth_admin_keep + + + + + + <_description>Eject media attached to another seat + <_message>Authentication is required to eject media from a drive plugged into another seat + + auth_admin + auth_admin + auth_admin_keep + + + + + <_description>Modify a device 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 */ -- cgit v1.2.3