• 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: NSUIElement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUIElement


  • Subject: Re: NSUIElement
  • From: Simon Stapleton <email@hidden>
  • Date: Sat, 5 Oct 2002 18:36:15 +0200

On Friday, October 4, 2002, at 10:12 pm, Ben Mackin wrote:

Ok, then what I will do is disable the option to switch if they are
not the
admin. How does one check if the current user has admin privileges, or
if
they are a "normal" user?

Wrong question. The question is not 'are they admin?', or even 'do they have admin priviledges?', but 'are they able they carry out the modification we want to do?'. And to do this, you'll want something like:

NSString * plistPath = nil;
BOOL isPlistWritable = NO;
if (plistPath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"]) {
isPlistWritable = [[NSFileManager defaultManager] isFileWritableAtPath:plistPath];
}
// Now check isPlistWritable and carry out the appropriate actions.

Hope that helps

Simon

--
PGP Key Id : 0x50D0698D
--
Your mouse has moved. You must restart Windows NT for this change to be recognised.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: Lock me tender, lock me true
  • Next by Date: CORBA for Client/Server
  • Previous by thread: Lock me tender, lock me true
  • Next by thread: CORBA for Client/Server
  • Index(es):
    • Date
    • Thread