You can do this however you want, but it is normally considered bad form to pipe the password in cleartext.
Amen to that. I strongly advise against using cleartext passwords.
RealBasic does not provide access to the security framework for elevated privileges directly, but that does not mean you cannot work around this.
You might consider prompting the user to authenticate with a work around. The easiest way I've found to do this in RealBasic is to use an AppleScript via a Shell by calling an osascript that calls another shell. Confused yet ?
dim myshell as new Shell
myshell.Execute "osascript -e 'do shell script ""/bin/ls -la"" with administrator privileges'"
Hey Pony, thanks for this.
It seems to work but also throw some errors.
No big deal I guess since you parse out the desired response but does it normally throw errors for you?
What do you parse for success?
2013-05-01 22:14:39.785 osascript[76500:607] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.
Alternatively for those that have MBS there is MBSauthorize.
If I remember correctly I think you can also elevate your app to admin or root privs a single time -probably a permission requiring admin pwd then never have to bother the user again. But this is generally frowned upon unless you have a very good reason to do it, which is rare.