Re: determine Admin vs nonAdmin users
Re: determine Admin vs nonAdmin users
- Subject: Re: determine Admin vs nonAdmin users
- From: John Stewart <email@hidden>
- Date: Mon, 24 Jan 2005 07:50:13 -0500
On 01/23/05 at -0800 Graham Anderson said this
>is there a 'do shell script' or applescript out there that determine if
>the user has admin privs?
do shell script "whoami | id | grep admin"
If the user has admin privileges this will return a string containing the uid etc. for the user. If the user doesn't have admin privileges the returned string will be empty.
OMM it returns -> uid=501(myshortname) gid=20(staff) groups=20(staff), 80(admin)
So this will do what you ask in AppleScript
--> Cut <--
set admin to do shell script "whoami | id | grep admin"
if admin ≠ "" then -- not equal to
-- do your admin stuff here
else
-- do non admin stuff here
end if
--> Cut <--
Any line in this script which starts at the left margin has been wrapped.
You may need to manually append such a line to the end of the preceeding line if it's a "hard" wrap.
JBS
--
A clear conscience is usually the sign of a bad memory.
_______________________________________________
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