summaryrefslogblamecommitdiff
path: root/user/udisks2/50-udisks2.rules
blob: 4c6088eaf2bdf290556bda1869c1b0b533e92d60 (plain) (tree)


























                                                                                              
// Source: https://gist.github.com/Scrumplex/8f528c1f63b5f4bfabe14b0804adaba7
// Original rules: https://github.com/coldfix/udiskie/wiki/Permissions
// Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin.

polkit.addRule(function(action, subject) {
  var YES = polkit.Result.YES;
  // NOTE: there must be a comma at the end of each line except for the last:
  var permission = {
    // required for udisks2:
    "org.freedesktop.udisks2.filesystem-mount": YES,
    "org.freedesktop.udisks2.encrypted-unlock": YES,
    "org.freedesktop.udisks2.eject-media": YES,
    "org.freedesktop.udisks2.power-off-drive": YES,
    // Dolphin specific
    "org.freedesktop.udisks2.filesystem-mount-system": YES,
    // required for udisks2 if using another seat:
    "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
    "org.freedesktop.udisks2.filesystem-unmount-others": YES,
    "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
    "org.freedesktop.udisks2.eject-media-other-seat": YES,
    "org.freedesktop.udisks2.power-off-drive-other-seat": YES
  };
  // This is a terrible group choice, but nobody on the Horizon team wanted to
  // give admins 'disk', which would be so much more appropriate...
  if (subject.isInGroup("usb")) {
    return permission[action.id];
  }
});