• 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: Luther Fuller <email@hidden>
  • Date: Sun, 08 Jan 2012 09:31:13 -0600

My script now sets everyone's privileges for all the files and folders it creates to Read & Write.
This solves the problem except for one folder.
The Finder's dictionary contains:

owner privileges read only | read write | write only | none

It should also contain, but does not contain, the command:

user privileges read only | read write | write only | none

So, I wrote a 'userPrivileges' handler to do this ...

tell application "Finder"
if not (everyones privileges of projectFolder is read write) then
if my userPrivileges(projectFolder) is not read write then error privsMessage
end if
end tell

on userPrivileges(itemAlias)
tell application "System Events" to set userName to (name of current user)
tell application "Finder"
if (owner of itemAlias) = userName then return (owner privileges of itemAlias)
end tell
set uprivs to do shell script "ls -eod " & (quoted form of (POSIX path of itemAlias))
set AppleScript's text item delimiters to {"user:" & userName}
try
set uprivs to (text item 2 of uprivs)
on error
tell application "Finder" to return none
end try
set AppleScript's text item delimiters to {return}
set uprivs to (text item 1 of uprivs)
tell application "Finder"
if not (uprivs contains "allow") then return none
if (uprivs contains "readattr,writeattr,readextattr,writeextattr") then return read write
if (uprivs contains "readattr,writeattr,writeextattr") then return write only
if (uprivs contains "readattr,readextattr") then return read only
return none
end tell
end userPrivileges ----------------------------

So far, this seems to be working correctly, but I still need to verify that I am using the 'ls' command correctly.
I may have missed an important detail somewhere.

 _______________________________________________
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: 
 >User Privileges (From: Luther Fuller <email@hidden>)
 >Re: User Privileges (From: Ron Hunsinger <email@hidden>)

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