Re: Is the User an Admin?
Re: Is the User an Admin?
- Subject: Re: Is the User an Admin?
- From: "Adam Bell" <email@hidden>
- Date: Thu, 23 Mar 2006 00:35:09 -0400
I should have added that the script is Jon Nathan's posted quite a while ago to
bbs.applescript.net.
On 3/23/06, Adam Bell
<email@hidden> wrote:
This does it for me:
set current_user to (do shell script "whoami")
set admin_users to (do shell script "/usr/bin/niutil -readprop . /groups/admin users")
tell (a reference to AppleScript's text item delimiters)
set {old_atid, contents} to {contents, " "}
set {admin_users, contents} to {text items of admin_users, old_atid}
end tell
if current_user is in admin_users then
return current_user & ": admin"
else
return current_user & ": not admin"
end if
I know that by using System Events I can get the (current) user's name. Is there any way to find out the user's privileges?
I'd like to be friendly and do something like:
if current user is an admin then
do shell script "whatever"
else
do shell script "whatever" with administrator privileges
end if
Thanks,
Chuck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (
--
Some minds remain open long enough for a truth to both enter and leave without processing.
--
Some minds remain open long enough for a truth to both enter and leave without processing.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden