• 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
Writing kCFPreferencesAnyUser preferences by limited user
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Writing kCFPreferencesAnyUser preferences by limited user


  • Subject: Writing kCFPreferencesAnyUser preferences by limited user
  • From: Alexander Shmelev <email@hidden>
  • Date: Sat, 14 Feb 2009 02:54:00 +0300

Hello,

I have Cocoa application, which have to store global settings, so I use CFPreferences...(..., kCFPreferencesAnyUser, kCFPreferencesCurrentHost).
Everything was ok while I launched application as admin user, but when I switched to limited user, settings changes were not saved.
I have found that I should use Security.framework. Then I wrote code below, it shows authentication dialog for limited user, but settings still not saving for limited user.
What do I do wrong? Could you advise me how to fix code?



extern OSStatus AcquireRight(const char *rightName)
{
OSStatus err;
static const AuthorizationFlags kFlags = kAuthorizationFlagInteractionAllowed
| kAuthorizationFlagExtendRights;
AuthorizationItem kActionRight = { rightName, 0, 0, 0 };
AuthorizationRights kRights = { 1, &kActionRight };

assert(gAuthorization != NULL);

// Request the application-specific right.

err = AuthorizationCopyRights(
gAuthorization, // authorization
&kRights, // rights
kAuthorizationEmptyEnvironment, // environment
kFlags, // flags
NULL // authorizedRights
);

return err;
}



...

OSStatus err = AuthorizationCreate(NULL, NULL, 0, &gAuthorization);
err = AcquireRight("system.preferences");

CFPreferencesSetValue(CFSTR("jpegCompressionFactor"), (CFNumberRef)jpegCompression, CFSTR(MFSDomainName),
kCFPreferencesAnyUser, kCFPreferencesCurrentHost);
CFPreferencesSynchronize(CFSTR(MFSDomainName), kCFPreferencesAnyUser, kCFPreferencesCurrentHost);
...


---
BR, Alexander

_______________________________________________

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


  • Follow-Ups:
    • Re: Writing kCFPreferencesAnyUser preferences by limited user
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: NSCollectionView inside an NSSplitView?
  • Next by Date: Re: newbie question on creating .png files
  • Previous by thread: Re: NSTreeController - Remove Children
  • Next by thread: Re: Writing kCFPreferencesAnyUser preferences by limited user
  • Index(es):
    • Date
    • Thread