// Clawdie operator USB power controls.
// SDDM/XFCE sessions should be able to suspend/restart/shutdown from the
// desktop without a password prompt. The live operator user is a wheel member;
// other users keep the upstream ConsoleKit policy.
polkit.addRule(function (action, subject) {
  var allowed = [
    "org.freedesktop.consolekit.system.suspend",
    "org.freedesktop.consolekit.system.suspend-multiple-users",
    "org.freedesktop.consolekit.system.hibernate",
    "org.freedesktop.consolekit.system.hibernate-multiple-users",
    "org.freedesktop.consolekit.system.hybridsleep",
    "org.freedesktop.consolekit.system.hybridsleep-multiple-users",
    "org.freedesktop.consolekit.system.restart",
    "org.freedesktop.consolekit.system.restart-multiple-users",
    "org.freedesktop.consolekit.system.stop",
    "org.freedesktop.consolekit.system.stop-multiple-users"
  ];

  if (subject.isInGroup("wheel") && allowed.indexOf(action.id) >= 0) {
    return polkit.Result.YES;
  }
});
