Polkit: Difference between revisions
Show how to do authorization request debugging |
m fix indentation |
||
| Line 22: | Line 22: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
security.polkit.extraConfig = '' | |||
polkit.addRule(function (action, subject) { | |||
if ( | |||
subject.isInGroup("users") && | |||
[ | |||
"org.freedesktop.login1.reboot", | |||
"org.freedesktop.login1.reboot-multiple-sessions", | |||
"org.freedesktop.login1.power-off", | |||
"org.freedesktop.login1.power-off-multiple-sessions", | |||
].indexOf(action.id) !== -1 | |||
) { | |||
return polkit.Result.YES; | |||
} | |||
}); | |||
''; | |||
</nowiki>}} | </nowiki>}} | ||
| Line 43: | Line 43: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
security.polkit.extraConfig = '' | |||
polkit.addRule(function(action, subject) { | |||
if (subject.isInGroup("wheel")) | |||
return polkit.Result.YES; | |||
}); | |||
''; | |||
</nowiki>}} | </nowiki>}} | ||
| Line 58: | Line 58: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
security.polkit = { | |||
debug = true; // Enables `polkit.log` function | |||
extraConfig = '' | |||
polkit.addRule(function(action, subject) { | |||
polkit.log(""); | |||
polkit.log("action=" + action); | |||
polkit.log("subject=" + subject); | |||
}); | |||
''; | |||
}; | |||
</nowiki>}} | </nowiki>}} | ||