Matrix Science header

ms_security_user.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_security_user.hpp                                                 #
00004 # 'msparser' toolkit                                                         #
00005 # Encapsulates a mascot user as used in authentication                       #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2004 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Archive:: /MowseBranches/ms_mascotresfile_1.2/include/ms_mascotresfi $ #
00012 #     $Author: villek@matrixscience.com $ #
00013 #       $Date: 2018-07-30 16:23:53 +0100 $ #
00014 #   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_7_0-0-g3d31d2559e $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 
00020 
00021 #if !defined(ms_security_user_INCLUDED_)
00022 #define ms_security_user_INCLUDED_
00023 
00024 
00025 // Includes from the standard template library
00026 #include <string>
00027 #include <set>
00028 #include <vector>
00029 #include <map>
00030 #include <time.h>
00031 
00032 
00033 namespace matrix_science {
00038 
00039 
00048     class MS_MASCOTRESFILE_API ms_user
00049     {
00050 
00051     public:
00053 
00056         enum usertype
00057         {
00058             USER_SECURITY_DISABLED  = 0x0000, 
00059             USER_NORMAL             = 0x0001, 
00060             USER_INTEGRA            = 0x0002, 
00061             USER_COMPUTER_NAME      = 0x0003, 
00062             USER_IP_ADDRESS         = 0x0004, 
00063             USER_AGENT_STRING       = 0x0005, 
00064             USER_WEBAUTH            = 0x0006  
00065         };
00066 
00068 
00071         enum systemids
00072         {
00073             USERID_SECURITY_DISABLED= 0x0000, 
00074             USERID_GUEST            = 0x0001, 
00075             USERID_ADMINISTRATOR    = 0x0002, 
00076             USERID_CMDLINE          = 0x0003, 
00077             USERID_DAEMON           = 0x0004, 
00078             USERID_PUBLIC_SEARCHES  = 0x0005, 
00079             USERID_INTEGRA_SYSTEM   = 0x0006, 
00080             USERID_LAST             = 0x0007  
00081         };
00082         
00084         ms_user(const int         userID,
00085                 const std::string userName,
00086                 const std::string password,
00087                 const long        passwordExpiry,
00088                 const std::string fullName,
00089                 const std::string emailAddress,
00090                 const usertype    userType,
00091                 const bool        enabled);
00092 
00094         ms_user();
00095 
00096         // Copying constructor for c++ programs - don't document
00097         ms_user(const ms_user &src);
00098 
00099 #ifndef SWIG
00100         // Assignment operator for c++ programs - don't document
00101         ms_user & operator=(const ms_user & right);
00102 #endif
00103         ~ms_user();
00104 
00106         usertype  getUserType() const;
00107 
00109         void setUserType(usertype newVal);
00110 
00112         std::string getFullName() const;
00113 
00115         void setFullName(std::string newVal);
00116 
00118         std::string getEncryptedPassword() const;
00119 
00121         void setEncryptedPassword(std::string newVal);
00122 
00124         void setPassword(std::string barePassword);
00125 
00127         bool validatePassword(const std::string pwd, int & errorFlag) const;
00128 
00130         time_t getPasswordExpiry() const;
00131 
00133         void setPasswordExpiry(time_t newVal);
00134 
00136         int getID() const;
00137 
00139         void setID(int newVal);
00140 
00142         std::string getName() const;
00143 
00145         void setName(std::string newVal);
00146 
00148         bool isAccountEnabled() const;
00149 
00151         void setAccountEnabled(bool newVal);
00152 
00154         std::string getEmailAddress() const;
00155 
00157         void setEmailAddress(std::string newVal);
00158 
00160         bool hasPasswordExpired() const;
00161 
00163         bool saveStringParam(const std::string name, const std::string param);
00164 
00165 #ifndef SWIG
00166 
00167         bool getStringParam(const std::string name, std::string & param) const;
00168 #endif
00169 
00171         std::string getStringParam(const std::string name) const;
00172 
00174         bool clearParam(const std::string name);
00175 
00176 #ifndef SWIG
00177 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00178         typedef std::map<std::string, std::string> customParams_t;
00179         customParams_t getAllCustomParams() const { return params_; }
00180 #endif
00181 #endif
00182 
00183     private:
00184         int userID_;
00185         std::string userName_;
00186         std::string fullName_;
00187         std::string encryptedPassword_;
00188         time_t  passwordExpiry_;
00189         std::string emailAddress_;
00190         bool accountEnabled_;
00191         usertype userType_;
00192         customParams_t params_;
00193 
00194         void copyFrom(const ms_user * src);
00195     }; // end of security_group 
00197 }
00198 #endif // !defined(ms_security_user_INCLUDED_)

Copyright © 2020 Matrix Science Ltd.  All Rights Reserved. Generated on Sat Jan 25 2020 01:26:14