blob: 11172252fa8857d30429ffe8bd45669ab9a68fe9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// This script is modified from a similar script written by MindlessLeadership
// on Reddit
// See https://www.reddit.com/r/gnome/comments/gya4a5/comment/ftcu44n
// Prevent users from touching system power state when there are multiple
// sessions, unless they are in the `power` group
polkit.addRule(function(action, subject) {
if (action.id === "org.freedesktop.login1.suspend-multiple-sessions" ||
action.id === "org.freedesktop.login1.hibernate-multiple-sessions" ||
action.id === "org.freedesktop.login1.power-off-multiple-sessions" ||
action.id === "org.freedesktop.login1.reboot-multiple-sessions") {
if (subject.isInGroup("power")) {
return polkit.Result.YES;
} else {
return polkit.Result.AUTH_ADMIN;
}
}
});
|