On 21 Aug., 01:59, "Garrett Garcia" <[EMAIL PROTECTED]> wrote: > On Wed, Aug 20, 2008 at 9:53 AM, PeteDK <[EMAIL PROTECTED]> wrote: > > > On 20 Aug., 17:56, "Emily Rodgers" <[EMAIL PROTECTED]> wrote: > > > > -----Original Message----- > > > > From: django-users@googlegroups.com > > > > [mailto:[EMAIL PROTECTED] On Behalf Of Steve Holden > > > > Sent: 20 August 2008 16:37 > > > > To: django-users@googlegroups.com > > > > Subject: Re: how to locate the OS currently logged in user?? > > > > > PeteDK wrote: > > > > > Hi. > > > > > > I want to retreive the name of the currently logged in user > > > > on the OS > > > > > on which my django app lives. > > > > > Is this possible? > > > > > > The thing is. The app is to be used in a private > > > > environment, so all > > > > > the users have to log on to the webserver first(this cant > > > > be changed). > > > > > I would be nice to avoid having them to log into the django app > > > > > afterwards. > > > > > > So after they are logged into the webserver it would be > > > > fair to assume > > > > > they are authorised users and if i could just locate their > > > > OS username > > > > > somehow then i could use this username to login the current > > > > user, in > > > > > the background with a standard password. > > > > > > I hope you get my meaning:) > > > > > > i have looked into the python standard library, and a module named > > > > > getpass() however i cant get i to work:-( > > > > > > i hope someone has a clever idea to solve this problem. > > > > > You seem to be assuming that the server is always accessed > > > > from a browser running on the same machine. You should > > > > guarantee this by running Django only on the 127.0.0.1 > > > > interface. As has already been pointed out, they need not be > > > > the only user logged on, however. > > > > It does seem like a really odd thing to do. Are you sure you don't just > > > want to find out the user viewing the webapp via a browser (who has > > > already authenticated in a system other than django)? > > > Well yeah that is what i want. I'm sorry if i haven't explained myself > > well enough. > > The system works like this: The user follows a link to the django app. > > The app is stored on a server which requires authentication. (This way > > the users can use the same password for the server as they use on the > > rest of the system.) What i want is i want to know the user who is > > trying to view the django app, so that i can, in the background, log > > this user into the django app. This way they dont have to have 2 > > separate user accounts with 2 separate passwords. > > What do you mean when you say "the server requires authentication"? How are > users accessing the server? Are they SSH-ing in or do you mean they are > accessing a different web site hosted on this server and are authenticating > through that? > > > > > So i dont need to know the users password, just the username. Because > > then i can use this to find a corresponding username in the django app > > and log the user in this way. i hope i made it more clear :-) > > > But actually i think the first solution would work find: > > > namelist = [line.split()[0] for line in commands.getoutput("/usr/bin/ > > who").split("\n")] > > userLoggingIn = namelist[-1] > > > unless there can be problems with using the latest user entry in the > > namelist?
The server is running Debian Linux and they are logging on to the server using the username and password stored in the active directory on one of the other servers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---