Re: recycleURLs with authorization
On Thursday, June 18, 2015, sqwarqDev sqwarq...@icloud.com wrote: Thanks Sean That's certainly interesting, but seems like overkill in my case. SMJobBless seems to be addressing a bigger problem - how to let an app run privileged tasks without authorizing the entire app and without repeatedly asking the user for a password. That's not quite what I want. I actually want the user to be prompted for the password whenever it's needed just in the same way that Finder does. I don't see that as quite the same thing. All I'm trying to do is to get the system to not fail the move with a permission denied error and to seek that permission from the user. I can achieve this simply enough with applescript, but I was hoping there was a Cocoa solution. I would file a Radar. Typically that's the case when there appears to be missing functionality -- and if you're doing something wrong, an Apple engineer can sometimes point you in the right direction. Best Phil On 18 Jun 2015, at 09:13, Sean McBride s...@rogue-research.com javascript:; wrote: On Thu, 18 Jun 2015 08:16:48 +0700, sqwarqDev said: Hi list I'm trying to move some files to the trash with my app, but I need OS X to throw an authentication dialog when the requested file needs permission to be moved. I need a solution that will work from 10.6 onwards, so I've been looking at NSWorkspace's recycleURLs rather than NSFileManager's trashItemAtURL (not available pre 10.8). My problem is that recycleURLs doesn't appear to offer an option to ask the user for a password if it's needed. Is there another method I can use that will, or a way to make recycleURLs throw the dialog? I know I could probably run an NSTask and call rm but that's a bit more brutal than what I'm looking for. I'd like the user to actually see the file in the Trash and to know that they've authorised its removal. You should look at the SMJobBless sample code, which I think is the current way to do things: https://developer.apple.com/library/mac/samplecode/SMJobBless/Introduction/Intro.html Cheers, -- Sean McBride, B. Eng s...@rogue-research.com javascript:; Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com javascript:;) 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: https://lists.apple.com/mailman/options/cocoa-dev/sevenbitstech%40gmail.com This email sent to sevenbitst...@gmail.com javascript:; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs with authorization
Thanks Sean That's certainly interesting, but seems like overkill in my case. SMJobBless seems to be addressing a bigger problem - how to let an app run privileged tasks without authorizing the entire app and without repeatedly asking the user for a password. That's not quite what I want. I actually want the user to be prompted for the password whenever it's needed just in the same way that Finder does. I don't see that as quite the same thing. All I'm trying to do is to get the system to not fail the move with a permission denied error and to seek that permission from the user. I can achieve this simply enough with applescript, but I was hoping there was a Cocoa solution. Best Phil On 18 Jun 2015, at 09:13, Sean McBride s...@rogue-research.com wrote: On Thu, 18 Jun 2015 08:16:48 +0700, sqwarqDev said: Hi list I'm trying to move some files to the trash with my app, but I need OS X to throw an authentication dialog when the requested file needs permission to be moved. I need a solution that will work from 10.6 onwards, so I've been looking at NSWorkspace's recycleURLs rather than NSFileManager's trashItemAtURL (not available pre 10.8). My problem is that recycleURLs doesn't appear to offer an option to ask the user for a password if it's needed. Is there another method I can use that will, or a way to make recycleURLs throw the dialog? I know I could probably run an NSTask and call rm but that's a bit more brutal than what I'm looking for. I'd like the user to actually see the file in the Trash and to know that they've authorised its removal. You should look at the SMJobBless sample code, which I think is the current way to do things: https://developer.apple.com/library/mac/samplecode/SMJobBless/Introduction/Intro.html Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs with authorization
On Thu, 18 Jun 2015 08:16:48 +0700, sqwarqDev said: Hi list I'm trying to move some files to the trash with my app, but I need OS X to throw an authentication dialog when the requested file needs permission to be moved. I need a solution that will work from 10.6 onwards, so I've been looking at NSWorkspace's recycleURLs rather than NSFileManager's trashItemAtURL (not available pre 10.8). My problem is that recycleURLs doesn't appear to offer an option to ask the user for a password if it's needed. Is there another method I can use that will, or a way to make recycleURLs throw the dialog? I know I could probably run an NSTask and call rm but that's a bit more brutal than what I'm looking for. I'd like the user to actually see the file in the Trash and to know that they've authorised its removal. You should look at the SMJobBless sample code, which I think is the current way to do things: https://developer.apple.com/library/mac/samplecode/SMJobBless/Introduction/Intro.html Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
recycleURLs with authorization
Hi list I'm trying to move some files to the trash with my app, but I need OS X to throw an authentication dialog when the requested file needs permission to be moved. I need a solution that will work from 10.6 onwards, so I've been looking at NSWorkspace's recycleURLs rather than NSFileManager's trashItemAtURL (not available pre 10.8). My problem is that recycleURLs doesn't appear to offer an option to ask the user for a password if it's needed. Is there another method I can use that will, or a way to make recycleURLs throw the dialog? I know I could probably run an NSTask and call rm but that's a bit more brutal than what I'm looking for. I'd like the user to actually see the file in the Trash and to know that they've authorised its removal. TIA Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com