• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is the User an Admin?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


On 3/23/06, chuck5566 <email@hidden > wrote:
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

References: 
 >Is the User an Admin? (From: chuck5566 <email@hidden>)
 >Re: Is the User an Admin? (From: "Adam Bell" <email@hidden>)

  • Prev by Date: Re: Is the User an Admin?
  • Next by Date: Workaround for tab into body of new message in Mail (tiger)
  • Previous by thread: Re: Is the User an Admin?
  • Next by thread: Workaround for tab into body of new message in Mail (tiger)
  • Index(es):
    • Date
    • Thread