Matrix Science header

ms_security_group.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_security_group.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: francoisr $ #
00013 #       $Date: 2016/04/18 10:59:56 $ #
00014 #   $Revision: 1.18 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 
00020 
00021 #if !defined(ms_users_group_INCLUDED_)
00022 #define ms_users_group_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 namespace matrix_science {
00057 
00058     class MS_MASCOTRESFILE_API ms_group
00059     {
00060 
00061     public:
00063 
00066         enum systemids
00067         {
00068             GROUPID_GUESTS          = 0x0001,  
00069             GROUPID_ADMINISTRATORS  = 0x0002,  
00070             GROUPID_POWERUSERS      = 0x0003,  
00071             GROUPID_DAEMONS         = 0x0004,  
00072             GROUPID_INTEGRA_SYSTEM  = 0x0005,  
00073             GROUPID_LAST            = 0x0006   
00074         };
00075 
00077         ms_group();
00078 
00080         ms_group(const int groupID, const std::string groupName);
00081 
00082         // Copying constructor for c++ programs - don't document
00083         ms_group(const ms_group &src);
00084 
00085 #ifndef SWIG
00086         // Assignment operator for c++ programs - don't document
00087         ms_group & operator=(const ms_group & right);
00088 #endif
00089         ~ms_group();
00090 
00092         bool addUser(const int userID);
00093 
00095         bool deleteUser(const int userID);
00096 
00098         bool isUserInGroup(const int userID) const;
00099 
00101         std::vector<int> getAllUserIDs(const void * const security = NULL, const int voidSortby = 1) const;
00102 
00104         std::string getName() const;
00105 
00107         void setName(const std::string newVal);
00108 
00110         void addPermittedTask(const matrix_science::ms_security_task & task);
00111 
00113         bool removePermittedTask(const int taskID);
00114 
00116         matrix_science::ms_security_tasks getPermittedTasks() const;
00117 
00119         void setPermittedTasks(matrix_science::ms_security_tasks& tasks);
00120 
00122         int  getID() const;
00123 
00125         void setID(int newVal);
00126 
00128         bool saveStringParam(const std::string name, const std::string param);
00129 
00130 #ifndef SWIG
00131 
00132         bool getStringParam(const std::string name, std::string & param) const;
00133 #endif
00134 
00136         std::string getStringParam(const std::string name) const;
00137 
00139         bool clearParam(const std::string name);
00140 
00141 #ifndef SWIG
00142 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00143         typedef std::map<std::string, std::string> customParams_t;
00144         customParams_t getAllCustomParams() const { return params_; }
00145 #endif
00146 #endif
00147 
00148     private:
00149         int groupID_;
00150         typedef std::set<int> users_t;
00151         ms_security_tasks tasks_;
00152         std::string groupName_;
00153         users_t     users_;
00154         customParams_t params_;
00155 
00156         void copyFrom(const ms_group * src);
00157         void updateUsersArrayTasks();
00158     }; // end of security_group 
00160 }
00161 #endif // !defined(ms_users_group_INCLUDED_)
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51