• 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: Test if app run by Guest account?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test if app run by Guest account?


  • Subject: Re: Test if app run by Guest account?
  • From: Andrew Farmer <email@hidden>
  • Date: Thu, 26 Feb 2009 17:51:12 -0800

On 26 Feb 09, at 15:04, Gerd Knops wrote:
On Feb 26, 2009, at 4:29 PM, Andrew Farmer wrote:
On 26 Feb 09, at 14:05, Karl Moskowski wrote:
I'm looking for a way to disable some features in my application if it's being run by the Leopard Guest account.

I tried using CSIdentityQueryCreateForCurrentUser() as outlined in the Identity Services Programming Guide to determine the current account running the app, and when run by an admin account, it returns the expected identity.

However, when run by Guest, the returned array of entries contains no objects. Would that be sufficient to reliably establish that the Guest account is current?

Comparing NSUserName() against @"guest" seems rather more straightforward, as well as less likely to break if Apple changes the way guest accounts are implemented.

But will that work in non-english speaking locales?

It should. NSUserName returns the UNIX account name, not the display name.


Alternatively, you could check the current UID.

On 26 Feb 09, at 15:07, Karl Moskowski wrote:
Also, it's possible to change the short-name of the Guest account, along with its User ID, Group ID, etc. in the Accounts PrefsPane. That's why I started looking at Identity Services.

It's probably safe to assume that users will leave these values alone, especially for the guest account. The big red warning is a pretty good deterrent.
_______________________________________________


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


References: 
 >Test if app run by Guest account? (From: Karl Moskowski <email@hidden>)
 >Re: Test if app run by Guest account? (From: Andrew Farmer <email@hidden>)
 >Re: Test if app run by Guest account? (From: Gerd Knops <email@hidden>)

  • Prev by Date: Custom button states?
  • Next by Date: Re: Why doesn't this work on my device?
  • Previous by thread: Re: Test if app run by Guest account?
  • Next by thread: NSOutlineView - a way to adjust column widths without a header?
  • Index(es):
    • Date
    • Thread