• 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 Installed Resouces (Admin Access)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User Installed Resouces (Admin Access)


  • Subject: Re: User Installed Resouces (Admin Access)
  • From: "Stefan Arentz" <email@hidden>
  • Date: Fri, 21 Sep 2007 21:54:48 +0200

On 9/18/07, Keith Duncan <email@hidden> wrote:
> I'm working on a new feature that allows the end user to install
> additional application resources post-install.
>
> I want to copy sound files to the application's support folder but I
> also want to give the user the option of installing the files for all
> users. An example of this can be seen in the System Preferences
> application when you install a new preference pane.
>
> I tried using NSFileManager and NSWorkspace methods to copy the files
> but they both fail and neither request authentication. I have hacked
> together some code that serves as a wrapper to
> AuthorizationExecuteWithPrivileges() allowing me to run arbitrary
> shell commands but I'd rather have a cleaner implementation.
>
> I'm also looking for a way to determine if the user has the rights to
> write to /Library/Application Support or if I have to put up an
> authorization panel before proceeding.

The admin group has write permission to /Library/Application Support.
To determine if the current user has the right permission you could
use getgrent("admin") to discover the members of the admin group.

Pseudo code:

current_user = getpwent();
group = getgrnam("admin")
if group.gr_mem contains current_user.pw_name then we are an admin

 S.
_______________________________________________

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: User Installed Resouces (Admin Access)
      • From: "Finlay Dobbie" <email@hidden>
References: 
 >User Installed Resouces (Admin Access) (From: Keith Duncan <email@hidden>)

  • Prev by Date: Re: NSArray - move Items at indexes
  • Next by Date: Re: really weird move file problem - copy fails also, more datapoints
  • Previous by thread: User Installed Resouces (Admin Access)
  • Next by thread: Re: User Installed Resouces (Admin Access)
  • Index(es):
    • Date
    • Thread