8660d03
/**
8660d03
 * Polkit permissions for udiskie.
8660d03
 * Source: Udiskie README (see https://pypi.python.org/pypi/udiskie)
8660d03
 */
8660d03
polkit.addRule(function(action, subject) {
8660d03
  var YES = polkit.Result.YES;
8660d03
  // NOTE: there must be a comma at the end of each line except for the last:
8660d03
  var permission = {
8660d03
    // required for udisks2:
8660d03
    "org.freedesktop.udisks2.filesystem-mount": YES,
8660d03
    "org.freedesktop.udisks2.encrypted-unlock": YES,
8660d03
    "org.freedesktop.udisks2.eject-media": YES,
8660d03
    "org.freedesktop.udisks2.power-off-drive": YES,
8660d03
    // required for udisks2 if using udiskie from another seat (e.g. systemd):
8660d03
    "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
8660d03
    "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
8660d03
    "org.freedesktop.udisks2.eject-media-other-seat": YES,
8660d03
    "org.freedesktop.udisks2.power-off-drive-other-seat": YES
8660d03
  };
8660d03
  // Allow memebers of the 'storage' group to run udiskie
8660d03
  if (subject.isInGroup("storage")) {
8660d03
    return permission[action.id];
8660d03
  }
8660d03
});