00001 /* 00002 * $Id: User.h 562 2007-12-02 08:04:16Z mindstorm2600 $ 00003 * 00004 * X-VR2 00005 * 00006 * Copyright (C) Juan V. Guerrero 2007 00007 * 00008 * Juan V. Guerrero <mindstorm2600@users.sourceforge.net> 00009 * 00010 * This program is free software, distributed under the terms of 00011 * the GNU General Public License Version 2. See the LICENSE file 00012 * at the top of the source tree. 00013 */ 00014 #ifndef __XVR2_USER_H__ 00015 #define __XVR2_USER_H__ 00016 00017 #include<xvr2/Unix.h> 00018 #include<xvr2/CoreExceptions.h> 00019 00020 namespace xvr2{ 00025 class User:protected Unix{ 00026 protected: 00028 int _userid; 00030 //String _username; 00031 std::string *string_representation; 00033 static char *_getUsername(int uid); 00034 public: 00040 User(); 00041 ~User(); 00045 User(int uid); 00050 User(const String &uname); 00052 int getUserID(); 00054 static int getCurrentUserID(); 00057 static int getUserID(const String &uname); 00059 static int getEffectiveUserID(); 00060 00062 static void setUserID(int uid); 00064 static void setUserID(const String &uname); 00066 static void setUserID(const User &usrobj); 00067 00069 static void setEffectiveUserID(int uid); 00071 static void setEffectiveUserID(const String &uname); 00073 static void setEffectiveUserID(const User &usrobj); 00074 00075 std::string toString(); 00076 }; 00077 } 00078 00079 #endif