76 lines
3 KiB
Text
76 lines
3 KiB
Text
// Mounting, checking, etc. of internal drives
|
|
polkit.addRule(function(action, subject) {
|
|
if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" ||
|
|
action.id == "org.freedesktop.udisks2.encrypted-unlock-system" ||
|
|
action.id == "org.freedesktop.udisks2.filesystem-fstab") &&
|
|
subject.active == true && subject.local == true &&
|
|
subject.isInGroup("sudo")) {
|
|
return polkit.Result.YES;
|
|
}
|
|
});
|
|
|
|
// Change CPU Frequency scaling
|
|
polkit.addRule(function(action, subject) {
|
|
if ((action.id == "org.gnome.cpufreqselector" ||
|
|
action.id == "org.mate.cpufreqselector" ) &&
|
|
subject.active == true && subject.local == true &&
|
|
subject.isInGroup("sudo")) {
|
|
return polkit.Result.YES;
|
|
}
|
|
});
|
|
|
|
// Setting the clock
|
|
polkit.addRule(function(action, subject) {
|
|
if ((action.id == "org.gnome.controlcenter.datetime.configure" ||
|
|
action.id == "org.kde.kcontrol.kcmclock.save" ||
|
|
action.id == "org.freedesktop.timedate1.set-time" ||
|
|
action.id == "org.freedesktop.timedate1.set-timezone" ||
|
|
action.id == "org.freedesktop.timedate1.set-local-rtc" ||
|
|
action.id == "org.freedesktop.timedate1.set-ntp" ||
|
|
action.id == "com.canonical.controlcenter.datetime.configure" ||
|
|
action.id == "org.mate.settingsdaemon.datetimemechanism.settime") &&
|
|
subject.active == true && subject.local == true &&
|
|
subject.isInGroup("sudo")) {
|
|
return polkit.Result.YES;
|
|
}
|
|
});
|
|
|
|
// Update already installed software
|
|
polkit.addRule(function(action, subject) {
|
|
if (action.id == "org.debian.apt.upgrade-packages" &&
|
|
subject.active == true && subject.local == true &&
|
|
subject.isInGroup("sudo")) {
|
|
return polkit.Result.YES;
|
|
}
|
|
});
|
|
|
|
// Printer administration
|
|
polkit.addRule(function(action, subject) {
|
|
if (action.id.indexOf("org.opensuse.cupspkhelper.mechanism.") == 0 &&
|
|
subject.active == true && subject.local == true &&
|
|
(subject.isInGroup("sudo") || subject.isInGroup("lpadmin"))) {
|
|
return polkit.Result.YES;
|
|
}
|
|
});
|
|
|
|
// Disable hibernate by default in Ubuntu
|
|
polkit.addRule(function(action, subject) {
|
|
if (action.id == "org.freedesktop.upower.hibernate" ||
|
|
action.id == "org.freedesktop.login1.hibernate" ||
|
|
action.id == "org.freedesktop.login1.handle-hibernate-key" ||
|
|
action.id == "org.freedesktop.login1.hibernate-multiple-sessions") {
|
|
return polkit.Result.NO;
|
|
}
|
|
});
|
|
|
|
// Allow admins to set the hostname,locale,keyboard,date/time without prompting
|
|
polkit.addRule(function(action, subject) {
|
|
if ((action.id == "org.freedesktop.locale1.set-locale" ||
|
|
action.id == "org.freedesktop.locale1.set-keyboard" ||
|
|
action.id == "org.freedesktop.hostname1.set-static-hostname" ||
|
|
action.id == "org.freedesktop.hostname1.set-hostname") &&
|
|
subject.active == true && subject.local == true &&
|
|
subject.isInGroup("sudo")) {
|
|
return polkit.Result.YES;
|
|
}
|
|
});
|