• 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: Root User
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Root User


  • Subject: Re: Root User
  • From: Luther Fuller <email@hidden>
  • Date: Sun, 30 Mar 2014 11:51:39 -0500

I just tested the following handler in OS X versions 10.7.5, 10.8.5 and 10.9.2.
It worked correctly and perfectly.

on getAdminPrivs()
set AppleScript's text item delimiters to " "
do shell script "id -G -n"
"admin" is in (text items of the result)
if the result then return -- current user is admin
try
do shell script "sw_vers" with administrator privileges
return -- admin username & password entered
end try
error number -128 -- kill this application
end getAdminPrivs -----------------------------------

Use it like this ...

on run
my getAdminPrivs()
--
-- your code here
-- cannot be run
-- without admin privileges
--
end run



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Root User (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: QuickTime Pro 7
  • Previous by thread: Re: Root User
  • Next by thread: Root User
  • Index(es):
    • Date
    • Thread