• 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: Fast User Switching in Panther...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast User Switching in Panther...


  • Subject: Re: Fast User Switching in Panther...
  • From: Dave Camp <email@hidden>
  • Date: Fri, 1 Aug 2003 13:15:31 -0700

It sounds to me that you are less interested in the "current user" (which does not exist as a concept) and probably more interested in knowing the User that owns the process that is invoking your service. If you can get the PID of the calling process, it seems like that should not be hard. This also has the advantage of working correctly should Apple ever add any sort of remote user functionality, which would mean you would be dealing with multiple simultaneous users. The code model you are suggesting would not work in that case.

Perhaps someone else here can elaborate on the code needed for this if necessary...

Hope that helps,
Dave

On Friday, August 1, 2003, at 12:32 PM, Alec Carlson wrote:

I have a background app and a plug-in which runs as a subprocess of a
daemon. Both of these entities need to know who is making requests for their
services - the logged in user or the current (fast switched) user. This
information is used to authenticate the user locally and remotely, to access
the users preferences which are not kept in the ~user/Library/Preferences
folder because they need to be accessible when the user is not logged in,
and to store files in user specific folders whether the user is logged in or
not. As such, both processes need to know who is making the request so that
when the request completes sometime in the future, the processes know where
to put the results. Until Panther, you could only have one user logged in at
a time (ignoring the ssh case) and although you could have multiple
processes running as different users, those process couldn't interact with
our GUI so they couldn't make service requests. A second user wanting to use
their personal environment would have to logout the current user and then
login as themselves. This reset the logged in userid so all was well. So,
when a user makes a request for services, I need to know who they are (at
that point in time). If someone else comes along and makes another request I
don't care so long as I can tell the two users apart.

Alec

on 8/1/03 12:18 PM, Dave Camp at email@hidden wrote:

On Friday, August 1, 2003, at 09:33 AM, Alec Carlson wrote:

Is there an API which allows an application to track who the current
user is
? It doesn't seem like the logged in user is logged out when a user
switch
occurs. So, how can an app find out who the current user is when a user
switch occurs ? SCDynamicStoreCopyConsoleUser( NULL, &uid, &gid )
returns
the logged in user not the current user.

Why do you need to know? What are you trying to accomplish?

I'm not sure there is a concept of a "current user". Processes
typically run as the user that launched them, or run as a special user
if need. For example, there are processes on your machine running as
you, root, www (if you have web sharing on), etc. If someone logged in
via ssh, they would have processes running as their user as well.

Dave
---
It is dark; you are likely to be eaten by a grue. -Zork


-----------------------------------------------------------------------
Time is Short, and the Water Rises
-----------------------------------------------------------------------
_______________________________________________
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.


---
It is dark; you are likely to be eaten by a grue. -Zork
_______________________________________________
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: 
 >Re: Fast User Switching in Panther... (From: Alec Carlson <email@hidden>)

  • Prev by Date: RE: Adding firewall rules at runtime...
  • Next by Date: Re: Adding firewall rules at runtime...
  • Previous by thread: Re: Fast User Switching in Panther...
  • Next by thread: App won't quit on logout
  • Index(es):
    • Date
    • Thread