En prennant pour exemple cette règle:
wiki.archlinux.org a écrit :The following rule disables suspend and hibernate for all users.
Code : Tout sélectionner
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") {
return polkit.Result.NO;
}
});
Cette fonction fonctionne sauf pour root alors qu'elle retourne pourtant polkit.Result.NO
polkit(8) a écrit :polkit.Result = {
NO : "no",
YES : "yes",
AUTH_SELF : "auth_self",
AUTH_SELF_KEEP : "auth_self_keep",
AUTH_ADMIN : "auth_admin",
AUTH_ADMIN_KEEP : "auth_admin_keep",
NOT_HANDLED : null
};
Code : Tout sélectionner
pkaction --verbose --action-id org.freedesktop.login1.hibernate
Comment faire pour qu'une règle polkit s'applique aussi à root?org.freedesktop.login1.hibernate:
description: Hibernate the system
message: Authentication is required for hibernating the system.
vendor: The systemd Project
vendor_url: http://www.freedesktop.org/wiki/Software/systemd
icon:
implicit any: auth_admin_keep
implicit inactive: auth_admin_keep
implicit active: yes
Merci pour votre aide.