• 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 access privileges to plist in /library/preferences
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: user access privileges to plist in /library/preferences


  • Subject: Re: user access privileges to plist in /library/preferences
  • From: Memo Akten <email@hidden>
  • Date: Wed, 1 Apr 2009 17:16:47 +0100

Hi Greg, actually /Users/Shared didn't work either. If I am logged in as admin it works, but if I am logged in as a normal user it doesn't. My code is:

#define LOG_PATH_FOLDER @"/Users/Shared/Library/Preferences/"
#define LOG_FILENAME @"MyLog.plist"
#define LOG_PATH [LOG_PATH_FOLDER stringByAppendingPathComponent:LOG_FILENAME]


NSFileManager *fileManager = [NSFileManager defaultManager];
if([fileManager fileExistsAtPath: LOG_PATH_FOLDER] == NO) {
NSLog(@"creating folder %@", LOG_PATH_FOLDER);
[fileManager createDirectoryAtPath: LOG_PATH_FOLDER attributes: nil];
}

logInfo = [[NSMutableDictionary alloc] initWithContentsOfFile: LOG_PATH];
if(logInfo == nil) logInfo = [[NSMutableDictionary alloc] init];





On 30 Mar 2009, at 01:14, Memo Akten wrote:

Hi Greg, /Users/Shared may work, I'll give that a shot thanks.

On 27 Mar 2009, at 18:26, Greg Guerin wrote:


I'd like the file to be user independent, so it should always read/ write to
the same file whoever logs in (it actually collects stats of usage). Is
there a better place to store the file? (has to be outside of / users) How
can I overcome the privileges issue?

If it's just collecting stats of usage, then why don't you use a public-readable file in each user's private-writable Library dir.


Or store private-writable public-readable per-user plists in a public-writable dir like /Users/Shared. Or if /Users/Shared is unacceptable, then use another dir created for your app, or explain why /Users/Shared is unacceptable.

If you can avoid having to use AEWP and elevated privileges, it will greatly simplify things and enhance security.

Just because you *can* do something with AEWP doesn't mean you *should*.

-- GG

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: disable row highlighting NSTableView
  • Next by Date: Re: Shortcut handling in different keyboard layouts
  • Previous by thread: Re: Handling List of Hardware Devices in NSTableView w/ Asynchronous Updates
  • Next by thread: Re: user access privileges to plist in /library/preferences
  • Index(es):
    • Date
    • Thread