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

Re: User Privileges


  • Subject: Re: User Privileges
  • From: Ron Hunsinger <email@hidden>
  • Date: Fri, 06 Jan 2012 15:51:23 -0800

On Jan 6, 2012, at 7:05 AM, Luther Fuller wrote:

> User "B" is logged in and, via an AppleScript, wants to get the privileges assigned to him by user "A".

If all "B" wants to do is see whether he has specific privileges, it might be simpler to just test for those specific privileges. Let the underlying security system do all the parsing of ACLs and what-not, and just give you the answer(s) to your specific question(s).

	set fyl to ... -- Posix path of the file of interest
	set whatIcanDo to do shell script "fyl=" & quoted form of fyl & "; perms=''; for att in d f r w x; do if [ -$att \"$fyl\" ]; then perms=$perms$att; fi; done; echo $perms"

In the example, the "specific questions" are "d f r w x" (is it a directory, is it a file, can I read it, can I write it, can I execute it). Check the man page for the test command (man test) to see what questions you can ask. The result is a string containing the questions for which the answer is yes. For example, a file you have read/write access to might return "frw" (file+read+write), and user "A"'s Drop Box folder might return "dwx" (directory+write+execute). A non-existent file would return an empty string.

-Ron Hunsinger _______________________________________________
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

  • Follow-Ups:
    • Re: User Privileges
      • From: Luther Fuller <email@hidden>
References: 
 >User Privileges (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: User Privileges
  • Next by Date: Jump to another page
  • Previous by thread: Re: User Privileges
  • Next by thread: Re: User Privileges
  • Index(es):
    • Date
    • Thread