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: davidc $ #
00013 #       $Date: 2015/07/31 15:48:07 $ #
00014 #   $Revision: 1.21 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 
00020 
00021 #if !defined(ms_security_user_INCLUDED_)
00022 #define ms_security_user_INCLUDED_
00023 
00024 #ifdef _WIN32
00025 #pragma warning(disable:4251)   // Don't want all classes to be exported
00026 #pragma warning(disable:4786)   // Debug symbols too long
00027 #   ifndef _MATRIX_USE_STATIC_LIB
00028 #       ifdef MS_MASCOTRESFILE_EXPORTS
00029 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00030 #       else
00031 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00032 #       endif
00033 #   else
00034 #       define MS_MASCOTRESFILE_API
00035 #   endif
00036 #else
00037 #   define MS_MASCOTRESFILE_API
00038 #endif
00039 
00040 // for the sake of #include <string>
00041 #ifdef __ALPHA_UNIX__
00042 #include <ctype.h>
00043 #endif
00044 
00045 // Includes from the standard template library
00046 #include <string>
00047 #include <set>
00048 #include <vector>
00049 #include <map>
00050 #include <time.h>
00051 
00052 
00053 namespace matrix_science {
00058 
00059 
00068     class MS_MASCOTRESFILE_API ms_user
00069     {
00070 
00071     public:
00073 
00076         enum usertype
00077         {
00078             USER_SECURITY_DISABLED  = 0x0000, 
00079             USER_NORMAL             = 0x0001, 
00080             USER_INTEGRA            = 0x0002, 
00081             USER_COMPUTER_NAME      = 0x0003, 
00082             USER_IP_ADDRESS         = 0x0004, 
00083             USER_AGENT_STRING       = 0x0005, 
00084             USER_WEBAUTH            = 0x0006  
00085         };
00086 
00088 
00091         enum systemids
00092         {
00093             USERID_SECURITY_DISABLED= 0x0000, 
00094             USERID_GUEST            = 0x0001, 
00095             USERID_ADMINISTRATOR    = 0x0002, 
00096             USERID_CMDLINE          = 0x0003, 
00097             USERID_DAEMON           = 0x0004, 
00098             USERID_PUBLIC_SEARCHES  = 0x0005, 
00099             USERID_INTEGRA_SYSTEM   = 0x0006, 
00100             USERID_LAST             = 0x0007  
00101         };
00102         
00104         ms_user(const int         userID,
00105                 const std::string userName,
00106                 const std::string password,
00107                 const long        passwordExpiry,
00108                 const std::string fullName,
00109                 const std::string emailAddress,
00110                 const usertype    userType,
00111                 const bool        enabled);
00112 
00114         ms_user();
00115 
00116         // Copying constructor for c++ programs - don't document
00117         ms_user(const ms_user &src);
00118 
00119 #ifndef SWIG
00120         // Assignment operator for c++ programs - don't document
00121         ms_user & operator=(const ms_user & right);
00122 #endif
00123         ~ms_user();
00124 
00126         usertype  getUserType() const;
00127 
00129         void setUserType(usertype newVal);
00130 
00132         std::string getFullName() const;
00133 
00135         void setFullName(std::string newVal);
00136 
00138         std::string getEncryptedPassword() const;
00139 
00141         void setEncryptedPassword(std::string newVal);
00142 
00144         void setPassword(std::string barePassword);
00145 
00147         bool validatePassword(const std::string pwd, int & errorFlag) const;
00148 
00150         time_t getPasswordExpiry() const;
00151 
00153         void setPasswordExpiry(time_t newVal);
00154 
00156         int getID() const;
00157 
00159         void setID(int newVal);
00160 
00162         std::string getName() const;
00163 
00165         void setName(std::string newVal);
00166 
00168         bool isAccountEnabled() const;
00169 
00171         void setAccountEnabled(bool newVal);
00172 
00174         std::string getEmailAddress() const;
00175 
00177         void setEmailAddress(std::string newVal);
00178 
00180         bool hasPasswordExpired() const;
00181 
00183         bool saveStringParam(const std::string name, const std::string param);
00184 
00185 #ifndef SWIG
00186 
00187         bool getStringParam(const std::string name, std::string & param) const;
00188 #endif
00189 
00191         std::string getStringParam(const std::string name) const;
00192 
00194         bool clearParam(const std::string name);
00195 
00196 #ifndef SWIG
00197 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00198         typedef std::map<std::string, std::string> customParams_t;
00199         customParams_t getAllCustomParams() const { return params_; }
00200 #endif
00201 #endif
00202 
00203     private:
00204         int userID_;
00205         std::string userName_;
00206         std::string fullName_;
00207         std::string encryptedPassword_;
00208         time_t  passwordExpiry_;
00209         std::string emailAddress_;
00210         bool accountEnabled_;
00211         usertype userType_;
00212         customParams_t params_;
00213 
00214         void copyFrom(const ms_user * src);
00215     }; // end of security_group 
00217 }
00218 #endif // !defined(ms_security_user_INCLUDED_)
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51