Allow All Users to Suspend the System Without Password Prompt (Fedora 28)

I have a mini tower PC and want to suspend it by a quick press of the power button. However, stock Fedora 28 requires normal users suspending the system to enter their password again if there are other users logged in.

It makes no sense to ask for a password after a user has pressed the suspend button (after all, if they wanted to deny service to other users, they could just as well power off the system while they have physical access).

So I want to disable that password prompt.

The following file placed in /etc/polkit-1/rules.d allows a user to suspend the system without needing the user’s password:

/etc/polkit-1/rules.d/10-allow-all-users-to-suspend.rules
1
2
3
4
5
6
polkit.addRule(function(action, subject) {
        if ((action.id == "org.freedesktop.login1.suspend-multiple-sessions")
            && subject.isInGroup("wheel")) {
                return polkit.Result.YES;
        }
});

If there is a way to allow the same thing with less permissions (remotely logged in users need not be able to suspend the system, after all), I do not know it. But this scratches my itch, so this concludes my interest in this matter.

(Documented so I can find it again the next time I install a system.)