polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.reboot" ||
        action.id == "org.freedesktop.login1.reboot-ignore-inhibit" ||
        action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
        action.id == "org.freedesktop.login1.power-off" ||
        action.id == "org.freedesktop.login1.power-off-ignore-inhibit" ||
        action.id == "org.freedesktop.login1.power-off-multiple-sessions" ||
	action.id == "org.freedesktop.login1.hibernate" ||
	action.id == "org.freedesktop.login1.hibernate-ignore-inhibit" ||
	action.id == "org.freedesktop.login1.hibernate-multiple-sessions") {
		if (subject.user != "root") {
                        return polkit.Result.NO;
                }
    }
});
