Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the User/Owner of another process



On Tuesday, September 30, 2003, at 03:51 pm, John Farmer wrote:

I need to be able to get the User/Owner of another process, like Finder. I
need to do this because I need to get the user name of the person currently
logged in. Now before you berate me, I did try to use NSUserName(),
NSFullUserName() functions.

There seems to be a very subtle bug in these functions.

No, there isn't a bug. Your expectation is wrong; given that many people can be logged in to a machine simultaneously, and given that they are executing as the "root" user, it wouldn't make sense for these functions to return anything else.

So I need to someway get the name of the person logged in, in a Startup Item
so I can setup the last preferences for the app and driver I am writing.

There are three *big* problems here:

1. There might not be anyone logged in.

2. There might be multiple users logged in (i.e. several Finder processes running as different users/groups).

3. Panther's fast user switching feature means that the user that owns the main display can change at the click of a button. This may well cause you complications.

What is your driver for? You need to think carefully about which user should own your device and therefore under what circumstances you should apply their preferences. For example, a driver for a removable media device should probably respect the preferences of whoever mounted it, whereas a driver for an input device should respect the preferences of the user that currently owns the main display.

Kind regards,

Alastair.
_______________________________________________
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.

References: 
 >Getting the User/Owner of another process (From: "John Farmer" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.