lint and fix polkit examples (#8381)

* lint and fix polkit examples

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* add changelog fragment

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* remove changelog fragment

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

---------

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
pull/8392/head
Thomas Sjögren 2024-05-19 20:50:41 +02:00 committed by GitHub
parent 03240ad7dc
commit f82e7a7b83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 12 deletions

View File

@ -78,9 +78,10 @@ DOCUMENTATION = '''
EXAMPLES = r'''
# A polkit rule needed to use the module with a non-root user.
# See the Notes section for details.
60-machinectl-fast-user-auth.rules: |
/etc/polkit-1/rules.d/60-machinectl-fast-user-auth.rules: |
polkit.addRule(function(action, subject) {
if(action.id == "org.freedesktop.machine1.host-shell" && subject.isInGroup("wheel")) {
if(action.id == "org.freedesktop.machine1.host-shell" &&
subject.isInGroup("wheel")) {
return polkit.Result.AUTH_SELF_KEEP;
}
});

View File

@ -71,7 +71,7 @@ EXAMPLES = r"""
/etc/polkit-1/rules.d/60-run0-fast-user-auth.rules: |
polkit.addRule(function(action, subject) {
if(action.id == "org.freedesktop.systemd1.manage-units" &&
subject.isInGroup("wheel")
subject.isInGroup("wheel") &&
subject.user == "ansible") {
return polkit.Result.YES;
}