MUser.h
1 /*****************************************************************************
2  **
3  ** Header file for Muster API User object
4  **
5  ** Name : MUser.h
6  ** Author : Leonardo Bernardini
7 ** Version : Alpha 9.0 Wed May 17th 2017
8  **
9  ** Copyright 2000-2017, Virtual Vertex
10  ** All Rights Reserved.
11  **
12  ** This file contains UNPUBLISHED PROPRIETARY SOURCE CODE.
13  ** The contents of this file may not be disclosed to third parties, copied
14  ** or duplicated in any form, in whole or in part, without the prior written
15  ** permission of the author.
16  **
17  *****************************************************************************/
18 #ifndef MUSER_H
19 #define MUSER_H
20 
21 #ifdef WIN32
22 // Windows definitions
23 #ifdef MCLIENTLIB_EXPORTS
24 #define MCLIENTLIB_API __declspec(dllexport)
25 #else
26 #define MCLIENTLIB_API __declspec(dllimport)
27 #endif
28 #else
29 
30 #ifndef MCLIENTLIB_EXPORTS
31 #ifdef LINUX
32 #define MCLIENTLIB_API
33 #else
34 #define MCLIENTLIB_API
35 #endif
36 #else
37 #define MCLIENTLIB_API
38 #endif
39 #endif
40 
41 
42 // Disable STL Export warning, member is private, we don't need direct access from the DLL client
43 #if defined(_WIN32)
44 #pragma warning(disable: 4251)
45 #endif // _WIN32
46 
47 #include <string>
48 #include <list>
49 #include <vector>
50 
51 namespace MClientLib {
52 
63  class MCLIENTLIB_API MUser {
64 
65  public:
66 
67  static const unsigned long long kUserRightJobsManageSelf = 0x01ULL;
68  static const unsigned long long kUserRightJobsManageOthers = 0x02ULL;
69  static const unsigned long long kUserRightJobsChangePriority = 0x04ULL;
70  static const unsigned long long kUserRightJobsDeleteSelf = 0x08ULL;
71  static const unsigned long long kUserRightJobsDeleteOthers = 0x10ULL;
72  static const unsigned long long kUserRightJobsLockSelf = 0x20ULL;
73  static const unsigned long long kUserRightJobsLockOthers = 0x40ULL;
74  static const unsigned long long kUserRightNodesChangeStatus = 0x80ULL;
75  static const unsigned long long kUserRightNodesManageProcesses = 0x100ULL;
76  static const unsigned long long kUserRightNodesSetNotes = 0x200ULL;
77  static const unsigned long long kUserRightNodesManageLog = 0x400ULL;
78  static const unsigned long long kUserRightNodesManageExclusions = 0x800ULL;
79  static const unsigned long long kUserRightNodesSoftRestart = 0x2000ULL;
80  static const unsigned long long kUserRightNodesSendEvents = 0x4000ULL;
81  static const unsigned long long kUserRightNodesChangePriority = 0x8000ULL;
82  static const unsigned long long kUserRightNodesChangeConfig = 0x10000ULL;
83  static const unsigned long long kUserRightDispatcherChangeConfigs = 0x20000ULL;
84  static const unsigned long long kUserRightDispatcherChangeStatus = 0x40000ULL;
85  static const unsigned long long kUserRightDispatcherSoftRestart = 0x80000ULL;
86  static const unsigned long long kUserRightSendJobs = 0x100000ULL;
87  static const unsigned long long kUserRightClearLog = 0x200000ULL;
88  static const unsigned long long kUserRightChangeOwnPassword = 0x400000ULL;
89  static const unsigned long long kUserRightLoginEnabled = 0x800000ULL;
90  static const unsigned long long kUserRightWebLoginEnabled = 0x1000000ULL;
91  static const unsigned long long kUserRightManageJobsHistory = 0x2000000ULL;
92  static const unsigned long long kUserRightImportQueue = 0x4000000ULL;
93  static const unsigned long long kUserRightIsAdmin = 0x10000000ULL;
94  static const unsigned long long kUserRightArchiveJobsBelogingToSelf = 0x20000000ULL;
95  static const unsigned long long kUserRightArchiveJobsBelogingToOthers = 0x40000000ULL;
96  static const unsigned long long kUserRightExportQueue = 0x80000000ULL;
97  static const unsigned long long kUserRightReceiveNodesTraffic = 0x100000000ULL;
98  static const unsigned long long kUserRightReceiveNodesTrafficUpdates = 0x200000000ULL;
99  static const unsigned long long kUserRightReceiveJobsTraffic = 0x400000000ULL;
100  static const unsigned long long kUserRightReceiveJobsTrafficUpdatesForOwnJobs = 0x800000000ULL;
101  static const unsigned long long kUserRightReceiveJobsTrafficUpdatedForJobsBelongingToOthers = 0x1000000000ULL;
102  static const unsigned long long kUserRightReceiveChunksTraffic = 0x2000000000ULL;
103  static const unsigned long long kUserRightReceiveChunksTrafficForChunksBelogingToOthers = 0x4000000000ULL;
104  static const unsigned long long kUserRightReceiveChunksTrafficUpdatesForOwnChunks = 0x8000000000ULL;
105  static const unsigned long long kUserRightReceiveChunksTrafficUpdatesForChunksBelogingToOthers = 0x10000000000ULL;
106  static const unsigned long long kUserRightReceiveLogTraffic = 0x20000000000ULL;
107  static const unsigned long long kUserRightReceiveLogUpdates = 0x80000000000ULL;
108  static const unsigned long long kUserRightConfigureRepositories = 0x100000000000ULL;
109  static const unsigned long long kUserRightConfigureAccounts = 0x200000000000ULL;
110  static const unsigned long long kUserRightConfigurePools = 0x400000000000ULL;
111  static const unsigned long long kUserRightConfigureTemplates = 0x800000000000ULL;
112  static const unsigned long long kUserRightSubmitScripts = 0x1000000000000ULL;
113  static const unsigned long long kUserRightJobsReparentSelf = 0x2000000000000ULL;
114  static const unsigned long long kUserRightJobsReparentOthers = 0x4000000000000ULL;
115  static const unsigned long long kUserRightSubmitToEmergencyQueue = 0x8000000000000ULL;
116  static const unsigned long long kUserRightBackupJobs = 0x10000000000000ULL;
117  static const unsigned long long kUserRightRestoreJobs = 0x20000000000000ULL;
118  static const unsigned long long kUserRightManageBackups = 0x40000000000000ULL;
119  static const unsigned long long kUserRightReceiveNodesAlarms = 0x80000000000000ULL;
120  static const unsigned long long kUserRightSilenceNodesAlarms = 0x100000000000000ULL;
121 
122  static const unsigned long long kUserRightFullRights = 0xFFFFFFFFFFFFFFFFULL;
123 
124  static const unsigned long long kUserRightDefaultGroupRights =
125  kUserRightReceiveLogUpdates | kUserRightReceiveLogTraffic | kUserRightReceiveChunksTrafficUpdatesForChunksBelogingToOthers |
126  kUserRightReceiveChunksTrafficUpdatesForOwnChunks | kUserRightReceiveChunksTrafficForChunksBelogingToOthers |
127  kUserRightReceiveChunksTraffic | kUserRightReceiveJobsTrafficUpdatedForJobsBelongingToOthers | kUserRightReceiveJobsTrafficUpdatesForOwnJobs |
128  kUserRightReceiveJobsTrafficUpdatesForOwnJobs | kUserRightReceiveJobsTrafficUpdatesForOwnJobs | kUserRightReceiveJobsTraffic |
129  kUserRightReceiveNodesTrafficUpdates | kUserRightReceiveNodesTraffic | kUserRightArchiveJobsBelogingToSelf | kUserRightWebLoginEnabled |
130  kUserRightLoginEnabled | kUserRightChangeOwnPassword | kUserRightSendJobs | kUserRightSubmitToEmergencyQueue | kUserRightJobsDeleteSelf | kUserRightJobsManageSelf ;
131 
132  static const unsigned long long kUserNotificationOwnJobCompleteSuccess = 0x01ULL;
133  static const unsigned long long kUserNotificationOthersJobCompleteSuccess = 0x02ULL;
134  static const unsigned long long kUserNotificationOwnChunkCompleteSuccess = 0x04ULL;
135  static const unsigned long long kUserNotificationOthersChunkCompleteSuccess = 0x08ULL;
136  static const unsigned long long kUserNotificationOwnJobCompleteWarnings = 0x10ULL;
137  static const unsigned long long kUserNotificationOthersJobCompleteWarnings = 0x20ULL;
138  static const unsigned long long kUserNotificationOwnChunkCompleteWarnings = 0x40ULL;
139  static const unsigned long long kUserNotificationOthersChunkCompleteWarnings = 0x80ULL;
140  static const unsigned long long kUserNotificationOwnJobCompleteErrors = 0x100ULL;
141  static const unsigned long long kUserNotificationOthersJobCompleteErrors = 0x200ULL;
142  static const unsigned long long kUserNotificationOwnChunkCompleteErrors = 0x400ULL;
143  static const unsigned long long kUserNotificationOthersChunkCompleteErrors = 0x800ULL;
144  static const unsigned long long kUserNotificationOwnJobStart = 0x1000ULL;
145  static const unsigned long long kUserNotificationOthersJobStart = 0x2000ULL;
146  static const unsigned long long kUserNotificationOwnChunkStart = 0x4000ULL;
147  static const unsigned long long kUserNotificationOthersChunkStart = 0x8000ULL;
148  static const unsigned long long kUserNotificationLogs = 0x10000ULL;
149  static const unsigned long long kUserNotificationEngineStatus = 0x20000ULL;
150  static const unsigned long long kUserNotificationSoftRestarts = 0x40000ULL;
151  static const unsigned long long kUserNotificationConfigsChanges = 0x80000ULL;
152  static const unsigned long long kUserNotificationExclusionListsEvents = 0x100000ULL;
153 
154  static const unsigned long long kUserNotificatorFullSet = 0xFFFFFFFFFFFFFFFFULL;
155 
156  static const unsigned long long kUserDefaultNotificators =
157  kUserNotificationOwnJobCompleteSuccess | kUserNotificationOwnJobCompleteWarnings |
158  kUserNotificationOwnJobCompleteErrors | kUserNotificationOwnJobStart;
159 
160  // Notification types
161  static const unsigned long long kNotificationJobComplete = 0x01ULL;
162  static const unsigned long long kNotificationChunkComplete = 0x02ULL;
163  static const unsigned long long kNotificationJobStart = 0x04ULL;
164  static const unsigned long long kNotificationChunkStart = 0x08ULL;
165  static const unsigned long long kNotificationLogs = 0x100ULL;
166  static const unsigned long long kNotificationEngineStatus = 0x200ULL;
167  static const unsigned long long kNotificationSoftRestarts = 0x400ULL;
168  static const unsigned long long kNotificationConfigsChanges = 0x800ULL;
169  static const unsigned long long kNotificationExclusionListsEvents = 0x1000ULL;
170 
178  kPropertyEnabled
179  };
180 
181  private:
182  long id;
183  std::string accountName;
184  std::string groups;
185  std::string emailAddress;
186  std::string encodedPassword;
187  unsigned long long allowedRights;
188  unsigned long long forbiddenRights;
189  unsigned long long allowedMailNotifications;
190  unsigned long long blockedMailNotifications;
191  unsigned long long allowedNotificatorNotifications;
192  unsigned long long blockedNotificatorNotifications;
193  unsigned long long allowedMobileNotifications;
194  unsigned long long blockedMobileNotifications;
195  int allowedTemplatesState;
196  int forbiddenTemplatesState;
197  int allowedPoolsState;
198  int forbiddenPoolsState;
199  int maximumInstancesState;
200  int maximumPriorityState;
201  int enableHomeFolderState;
202  int constrainToHomeFolderState;
203  int repositoriesState;
204  int limitedPoolsSkipOnIdleState;
205  int limitedInstancesSkipOnIdleState;
206  std::string allowedPools;
207  std::string forbiddenPools;
208  std::string allowedTemplates;
209  std::string forbiddenTemplates;
210  int maximumInstances;
211  int maximumPriority;
212  std::string repositories;
213  long homeFolderID;
214  bool isLdap;
215 
216  public:
217  MUser();
218 
219  virtual ~MUser();
220 
221  virtual void setId(long _id);
222  virtual void setAccountName(const std::string& _accountName);
223  virtual void setGroups(const std::string& _groups);
224  virtual void setEMailAddress(const std::string& _emailAddress);
225  virtual void setEncodedPassword(const std::string& _encodedPassword);
226  virtual void setAllowedRights(unsigned long long _rightsMask);
227  virtual void setForbiddenRights(unsigned long long _rightsMask);
228  virtual void setAllowedMailNotifications(unsigned long long _notificationsMask);
229  virtual void setBlockedMailNotifications(unsigned long long _notificationsMask);
230  virtual void setAllowedMobileNotifications(unsigned long long _notificationsMask);
231  virtual void setBlockedMobileNotifications(unsigned long long _notificationsMask);
232  virtual void setAllowedNotificatorNotifications(unsigned long long _notificationsMask);
233  virtual void setBlockedNotificatorNotifications(unsigned long long _notificationsMask);
234  virtual void setAllowedTemplatesState(int _allowedTemplatesState);
235  virtual void setForbiddenTemplatesState(int _forbiddenTemplatesState);
236  virtual void setAllowedPoolsState(int _allowedPoolsState);
237  virtual void setForbiddenPoolsState(int _forbiddenPoolsState);
238  virtual void setMaximumInstancesState(int _maximumInstancesState);
239  virtual void setMaximumPriorityState(int _maximumPriorityState);
240  virtual void setEnableHomeFolderState(int _enableHomeFolderState);
241  virtual void setConstrainToHomeFolderState(int _constrainToHomeFolderState);
242  virtual void setRepositoriesState(int _repositoriesState);
243  virtual void setLimitedPoolsSkipOnIdleState(int _limitedPoolsSkipOnIdleState);
244  virtual void setLimitedInstancesSkipOnIdleState(int _limitedInstancesSkipOnIdleState);
245  virtual void setAllowedPools(std::string _allowedPools);
246  virtual void setForbiddenPools(std::string _forbiddenPools);
247  virtual void setAllowedTemplates(std::string _allowedTemplates);
248  virtual void setForbiddenTemplates(std::string _forbiddenTemplates);
249  virtual void setMaximumInstances(int _maximumInstances);
250  virtual void setMaximumPriority(int _maximumPriority);
251  virtual void setRepositories(std::string _repositories);
252  virtual void setHomeFolderID(long _homeFolderID);
253  virtual void setIsLdap(bool _isLdap);
255  virtual long getId();
256  virtual std::string getAccountName();
257  virtual std::string getGroups();
258  virtual std::string getEMailAddress();
259  virtual std::string getEncodedPassword();
260  virtual unsigned long long getAllowedRights();
261  virtual unsigned long long getForbiddenRights();
262  virtual unsigned long long getAllowedMailNotifications();
263  virtual unsigned long long getBlockedMailNotifications();
264  virtual unsigned long long getAllowedNotificatorNotifications();
265  virtual unsigned long long getBlockedNotificatorNotifications();
266  virtual unsigned long long getAllowedMobileNotifications();
267  virtual unsigned long long getBlockedMobileNotifications();
268  virtual int getAllowedTemplatesState();
269  virtual int getForbiddenTemplatesState();
270  virtual int getAllowedPoolsState();
271  virtual int getForbiddenPoolsState();
272  virtual int getMaximumInstancesState();
273  virtual int getMaximumPriorityState();
274  virtual int getEnableHomeFolderState();
275  virtual int getConstrainToHomeFolderState();
276  virtual int getRepositoriesState();
277  virtual int getLimitedPoolsSkipOnIdleState();
278  virtual int getLimitedInstancesSkipOnIdleState();
279  virtual std::string getAllowedPools();
280  virtual std::string getForbiddenPools();
281  virtual std::string getAllowedTemplates();
282  virtual std::string getForbiddenTemplates();
283  virtual int getMaximumInstances();
284  virtual int getMaximumPriority();
285  virtual std::string getRepositories();
286  virtual long getHomeFolderID();
287  virtual bool getIsLdap();
290  virtual bool Unmarshall(const std::vector<std::string>& items);
291  virtual std::string Marshall();
292  void castedRelease();
294  };
295 
297 }
298 
299 #endif
Class holding an entry for a user.
Definition: MUser.h:63
kPropertyOverride
Properties overrides enumerations.
Definition: MUser.h:175