AuthorizationRef, AuthorizationCopyRights, with less user interaction
AuthorizationRef, AuthorizationCopyRights, with less user interaction
- Subject: AuthorizationRef, AuthorizationCopyRights, with less user interaction
- From: Jesse Grosjean <email@hidden>
- Date: Thu, 10 Mar 2005 17:31:59 -0500
My goal is to allow my application to call the IOPMSchedulePowerEvent()
and IOPMCancelScheduledPowerEvent() functions without requiring the
user to authorize (enter admin password) each time my application is
launched. I'm not sure if I'm going about this the right way, here is
my reasoning so far:
1. Documentation says these functions must be called as root.
2. To get root access I'm using the AuthSample code:
http://developer.apple.com/samplecode/AuthSample/AuthSample.html
technique. That is I put the code that needs root privileges in a
separate executable and (after setup with the Authorization framework)
I call executable from my main executable. The authorization privilege
that I try to get is "system.privilege.admin". I'm not sure if that's
the required one, if someone can advise that would be great.
3. Right now the code works, but it requires at least one Authorization
dialogue each time the user launches the application. And from what I
can tell it may require more as the documentation says the
authorizations can timeout.
My question, is it possible to save the users authorization password
somehow so that they don't have to keep entering it? I see some
constants "kAuthorizationEnvironmentUsername" and
"kAuthorizationEnvironmentPassword" that look promising, but I'm unsure
how to use them, and how to get the password from the user in the first
place.
If that's not possible what's the recommended way to allow my
application to make use of IOPMSchedulePowerEvent and
IOPMCancelScheduledPowerEvent without requiring the user to enter their
password each time my application is launched?
Thanks,
Jesse
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden