Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.

Commit f33c617

Browse files
committed
xfce polkit
1 parent 00442c6 commit f33c617

File tree

6 files changed

+69
-0
lines changed

6 files changed

+69
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[udisks1]
2+
Identity=unix-group:storage
3+
Action=org.freedesktop.udisks.filesystem-mount;org.freedesktop.udisks.luks-unlock;org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.drive-detach
4+
ResultAny=yes
5+
6+
[udisks2]
7+
Identity=unix-group:storage
8+
Action=org.freedesktop.udisks2.filesystem-mount;org.freedesktop.udisks2.encrypted-unlock;org.freedesktop.udisks2.eject-media;org.freedesktop.udisks2.power-off-drive
9+
ResultAny=yes
10+
11+
[udisks2-other-seat]
12+
Identity=unix-group:storage
13+
Action=org.freedesktop.udisks2.filesystem-mount-other-seat;org.freedesktop.udisks2.filesystem-unmount-others;org.freedesktop.udisks2.encrypted-unlock-other-seat;org.freedesktop.udisks2.eject-media-other-seat;org.freedesktop.udisks2.power-off-drive-other-seat
14+
ResultAny=yes
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
polkit.addRule(function(action, subject) {
2+
if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) {
3+
return polkit.Result.YES;
4+
}
5+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
polkit.addRule(function(action, subject) {
2+
var YES = polkit.Result.YES;
3+
// NOTE: there must be a comma at the end of each line except for the last:
4+
var permission = {
5+
// required for udisks1:
6+
"org.freedesktop.udisks.filesystem-mount": YES,
7+
"org.freedesktop.udisks.luks-unlock": YES,
8+
"org.freedesktop.udisks.drive-eject": YES,
9+
"org.freedesktop.udisks.drive-detach": YES,
10+
// required for udisks2:
11+
"org.freedesktop.udisks2.filesystem-mount": YES,
12+
"org.freedesktop.udisks2.encrypted-unlock": YES,
13+
"org.freedesktop.udisks2.eject-media": YES,
14+
"org.freedesktop.udisks2.power-off-drive": YES,
15+
// required for udisks2 if using udiskie from another seat (e.g. systemd):
16+
"org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
17+
"org.freedesktop.udisks2.filesystem-unmount-others": YES,
18+
"org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
19+
"org.freedesktop.udisks2.eject-media-other-seat": YES,
20+
"org.freedesktop.udisks2.power-off-drive-other-seat": YES
21+
};
22+
if (subject.isInGroup("storage")) {
23+
return permission[action.id];
24+
}
25+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
polkit.addRule(function(action, subject) {
2+
if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" ||
3+
action.id == "org.freedesktop.udisks.filesystem-mount-system-internal") &&
4+
subject.local && subject.active && subject.isInGroup("users"))
5+
{
6+
return polkit.Result.YES;
7+
}
8+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
polkit.addRule(function(action, subject) {
2+
if (/^org\.freedesktop\.udisks\./.test(action.id)
3+
&& subject.isInGroup("wheel"))
4+
{
5+
return polkit.Result.YES;
6+
}
7+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
polkit.addRule(function(action, subject) {
2+
if (action.id == "org.freedesktop.udisks.filesystem-mount") {
3+
if (subject.isInGroup("wheel"))
4+
return polkit.Result.YES;
5+
else
6+
return polkit.Result.AUTH_ADMIN_KEEP;
7+
} else if (/^org\.freedesktop\.udisks\./.test(action.id)) {
8+
return polkit.Result.AUTH_ADMIN_KEEP;
9+
}
10+
});

0 commit comments

Comments
 (0)