• 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: determine Admin vs nonAdmin users
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >determine Admin vs nonAdmin users (From: Graham Anderson <email@hidden>)

  • Prev by Date: Re: determine Admin vs nonAdmin users
  • Next by Date: Re: Open Filemaker Remote with Password
  • Previous by thread: Re: determine Admin vs nonAdmin users
  • Next by thread: How to update an applescript app from a remote server?
  • Index(es):
    • Date
    • Thread