You are not logged in.
Pages: 1
Hi,
I'd like to know what's wrong with this polkit:
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.login1.suspend" ||
action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
action.id == "org.freedesktop.login1.hibernate" ||
action.id == "org.freedesktop.login1.hibernate-multiple-sessions") && subject.isInGroup("power"))
{
return polkit.Result.YES;
}
});
I'm trying to let shutdown the system to the users in "power" group.
Thanks.
Offline
None of those actions is shutdown (or power-off). afaik the action you need is org.freedesktop.login1.power-off
Offline
Thanks, damjan, I didn't notice.
By the way, I'm not sure if the tutorial in your link is the correct way of doing it. I thought that admin settings should be made in /etc. Settings in /usr could change with a system upgrade.
I made a new rule in /etc/polkit-1/rules.d/48-shutdown-power-group.rules:
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.login1.reboot" ||
action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
action.id == "org.freedesktop.login1.power-off" ||
action.id == "org.freedesktop.login1.power-off-multiple-sessions" ||
action.id == "org.freedesktop.login1.suspend" ||
action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
action.id == "org.freedesktop.login1.hibernate" ||
action.id == "org.freedesktop.login1.hibernate-multiple-sessions") && subject.isInGroup("power"))
{
return polkit.Result.YES;
}
});
This works for me now. I can reboot or shutdown with any user in the "power" group.
Offline
Pages: 1