Get write authorization
Get write authorization
- Subject: Get write authorization
- From: Livio Isaia <email@hidden>
- Date: Mon, 18 Nov 2013 07:41:34 +0100
Hi all.
I have a simple cocoa app (Mac OS X 10.9) that must install (or remove) a framework to system/library/Frameworks. It seems to need permission to do that, as the NSFileManager copyItemAtPath method returns error 513 (NSCocoaErrorDomain/SFileWriteNoPermissionError).
So I tried to get authorization with:
OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &myAuthorizationRef);
if (status != errAuthorizationSuccess) {
AuthorizationItem right = {kAuthorizationRightExecute, 0, NULL, 0};
AuthorizationRights rights = {1, &right};
AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights;
status = AuthorizationCopyRights(myAuthorizationRef, &rights, NULL, flags, &rights2);
}
status is errAuthorizationSuccess, but copyItemAtPath method still returns error 513.
I tried to change the AuthorizationItem fields, but without success.
Any idea? I googled a lot but without success either.
Thank you all in advance,
bedt regards,
livio.
_______________________________________________
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