00001 #ifndef CLASSLIB_USER_INFO_H 00002 # define CLASSLIB_USER_INFO_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/sysapi/system.h" 00007 # include <sys/types.h> 00008 # include <string> 00009 00010 //<<<<<< PUBLIC DEFINES >>>>>> 00011 //<<<<<< PUBLIC CONSTANTS >>>>>> 00012 //<<<<<< PUBLIC TYPES >>>>>> 00013 00014 struct passwd; 00015 00016 namespace lat { 00017 // FIXME: Windows 00018 typedef uid_t UID; 00019 typedef gid_t GID; 00020 00021 //<<<<<< PUBLIC VARIABLES >>>>>> 00022 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00023 //<<<<<< CLASS DECLARATIONS >>>>>> 00024 00026 class UserInfo 00027 { 00028 public: 00029 UID uid (bool effective = true); 00030 GID gid (bool effective = true); 00031 std::string id (void); 00032 std::string domain (void); 00033 std::string logonserver (void); 00034 std::string name (void); 00035 std::string homedir (void); 00036 std::string homedrive (void); 00037 std::string password (void); 00038 std::string shell (void); 00039 00040 static UserInfo * self (void); 00041 static UserInfo * user (const std::string &id); 00042 00043 private: 00044 UserInfo (const std::string &id, UserInfo *next); 00045 UserInfo (struct passwd *entry, UserInfo *next); 00046 00047 static UserInfo *s_self; 00048 static UserInfo *s_users; 00049 00050 UserInfo *m_next; 00051 UID m_uid; 00052 UID m_euid; 00053 GID m_gid; 00054 GID m_egid; 00055 std::string m_id; 00056 std::string m_password; 00057 std::string m_name; 00058 std::string m_domain; 00059 std::string m_logsrv; 00060 std::string m_homepath; 00061 std::string m_homedrive; 00062 std::string m_shell; 00063 }; 00064 00065 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00066 00067 } // namespace lat 00068 #endif // CLASSLIB_USER_INFO_H