I am rewriting some old AS utility applications for Panther. Most of these applications should have restrictions on which files/folder the user has access to … that is, a User should run the script only on files/folders Owned by the User or on files/folders for which that User has Read&Write privileges.
This requires that my script read the information in the “You can” field under the Qwnership & Permissions tab of the file/folders Get Info window. As far as I know, neither the Finder nor System Events can read this info.
I don’t have Panther, and it looks like there might be some terminology changes, but this works in Jaguar.
set item_ to "path:to:file or folder"
tell application "Finder"
tell alias item_
set owner_ to owner
set group_ to group
set owner_privs to owner privileges
set group_privs to group privileges
set everyone_privs to everyones privileges
end tell
end tell
Knowing the owner or group and their privileges does not help. It’s the current users privileges that I’m looking for. There ought to be a ‘user privileges’ command somewhere, but it seems to be missing.
The umask command will tell you the permissions of any files that are created by a user. It’s generally 022, write access for owner only. The groups command will list the groups that the user is part of. They are command line programs, you use them in the terminal.
I think you need to read about permissions in Mac OS X. It’s completely different from previous OSes, both conceptually and actually.
Apple only includes a GUI for managing permissions with OS X Server. If you want a GUI utility you can use BatChmod. You can get it here: BatChmod. Like they say on the home page, you can really screw things up if you don’t know what you’re doing.
Um, it does help, you just have to know what the user’s name and group are (which can be found in a variety of ways using AS. See this script for more info) and then use an if-then block after getting the info from Rob’s script above.