Users online lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- xinyiman · 2011-03-30 07:30 Hello everyone. How do I know the username of users attached to a particular machine? There is a dedicated protocol to do this? How can I get the user name and the date on which it is authenticated on that machine? Thanks for you help. ---------------------------------------------------------------------- LazaruX · 2011-03-30 07:34 Which Operating System? Does "Environment Variables" help? If on Windows maybe through WMI you can get this info, I doubt about the date. ---------------------------------------------------------------------- xinyiman · 2011-03-30 07:42 In theory I do it for Windows, Linux and AS400. But I could already there for Windows and Linux I'd be happy. ---------------------------------------------------------------------- fabienwang · 2011-03-30 10:39 you can use: GetEnvironmentVariable('USER'); it will work on any platform. For the date of authentification, please look at the users unit in the users fpc package, you'll find interesting functions like GetUserList, GetUserData, GetUserUID etc. ---------------------------------------------------------------------- xinyiman · 2011-03-30 11:13 Ok, however, via either the environment variables do I know what all users are authenticated and what time? It's not that I will only return my username? ---------------------------------------------------------------------- fabienwang · 2011-03-30 11:15 no, GetEnvironmentVariable('USER'); will give the current user you're logged in with. To get the list of users in the system, and get more infos about them (like if they're connected, how long etc.) you have to see the users unit in the FPC/Units folder. ---------------------------------------------------------------------- xinyiman · 2011-03-30 11:59 I'm on windows and I can not find the folder users C:\lazarus\fpc\2.4.2\units\i386-win32 ---------------------------------------------------------------------- fabienwang · 2011-03-30 12:02 add users in the uses of your form. Put your mouse over it and Ctrl + Click, you should be in the users unit PS: it seems to be for linux only. ---------------------------------------------------------------------- xinyiman · 2011-03-30 13:02 And if you recover your username, how do I know what kind of user? For example, if I discover as administrator or root ---------------------------------------------------------------------- fabienwang · 2011-03-30 13:28 for Linux you could get the user groups and if he is in admins or root groups, then it's an admin, if not, he's a simple user. ---------------------------------------------------------------------- xinyiman · 2011-03-30 13:33 How do I know the user's group by lazarus on Linux? And on windows? Ideas?