I'm using web2py for an intranet site and need to get current login windows user id in my controller. Whether any function is available?
Asked
Active
Viewed 1,025 times
3 Answers
4
You need to install an NTLM authentication module on your web server such as mod_sspi or mod_ntlm then check the REMOTE_USER environment variable of the request. Here is something similar in Django: http://brandonkonkle.com/blog/2008/sep/13/django-apache-and-mod_auth_sspi/

mr.freeze
- 13,731
- 5
- 36
- 42
1
If you mean you need code at the server to know the windows id of the current browser user, web2py isn't going to be able to tell you that. Windows authentication has nothing to do with web protocols.

Ned Batchelder
- 364,293
- 75
- 561
- 662
-1
I don't know if that works but try psutil module, which is supposed to work on both Windows and Unix.
import os, psutil
ownPid = os.getpid() #This one works in Windows, but os.getuid() does not...
ownUid = [p.uid for p in psutil.process_iter()
if p.pid == ownPid][0]

macieksk
- 365
- 3
- 10