Comment 50 for bug 432598

Revision history for this message
Martin Pitt (pitti) wrote : Re: [Bug 432598] Re: Do not show suspend/hiberate related UI if suspend is disabled in polkit

Ted Gould [2010-03-08 19:27 -0000]:
> I don't understand why we should be removing the items on the menu if
> there is administrator privlidges required to do the action. It would
> seem that they should switch to a "Sleep..." but you should still be
> allowed to ask the machine to sleep and give your password. As I
> understand it, this is what the "Allowed" function check.

No, it checks whether you either already have or can get the privilege
(via entering your password) to suspend. If it says "no", it means
"no, you can't get it". Administrators who want to disable
suspend/hibernate would set this in the .pkla file.

> But, there are two other properties that are in upower that allow for
> setting whether the machine CanSuspend or CanHibernate. These are
> derived by catting /sys/power/state and looking to see if it contains
> "mem" and/or "disk." I believe that these are derivated from the
> drivers in the system saying what they in turn support.

Right, but those mean "the kernel says it's able to", which is
different from "PolicyKit says the user is allowed to". So we need to
check both.

Martin

--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)