summaryrefslogtreecommitdiff
path: root/user/udisks2/50-udisks2.rules
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-28 09:11:50 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-28 09:11:50 -0600
commitcb31da9e55a2173da2780fa998a16e4384001d66 (patch)
treeac73a12ba560db764b3b288eed31ba3c814fcf9d /user/udisks2/50-udisks2.rules
parentae20f2dfbda852fbbba2bd6754071788b1915c12 (diff)
downloadpackages-cb31da9e55a2173da2780fa998a16e4384001d66.tar.gz
packages-cb31da9e55a2173da2780fa998a16e4384001d66.tar.bz2
packages-cb31da9e55a2173da2780fa998a16e4384001d66.tar.xz
packages-cb31da9e55a2173da2780fa998a16e4384001d66.zip
user/udisks2: Finally add PolKit rules for mounting as user
Diffstat (limited to 'user/udisks2/50-udisks2.rules')
-rw-r--r--user/udisks2/50-udisks2.rules28
1 files changed, 28 insertions, 0 deletions
diff --git a/user/udisks2/50-udisks2.rules b/user/udisks2/50-udisks2.rules
new file mode 100644
index 000000000..4c6088eaf
--- /dev/null
+++ b/user/udisks2/50-udisks2.rules
@@ -0,0 +1,28 @@
+// 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];
+ }
+});