otsdaq  3.10.00
RemoteWebUsers.h
1 #ifndef _ots_Utilities_RemoteWebUsers_h
2 #define _ots_Utilities_RemoteWebUsers_h
3 
4 #include "otsdaq/SOAPUtilities/SOAPMessenger.h" //for xdaq::ApplicationDescriptor
5 #include "otsdaq/WebUsersUtilities/WebUsers.h"
6 
7 #include <iostream>
8 #include <map>
9 #include <mutex>
10 #include <string>
11 
12 #include "otsdaq/TableCore/TableGroupKey.h" //for TableGroupKey
13 
14 // clang-format off
15 namespace ots
16 {
17 class AllSupervisorInfo;
18 class HttpXmlDocument;
19 
25 {
26  public:
27  RemoteWebUsers(xdaq::Application* application, XDAQ_CONST_CALL xdaq::ApplicationDescriptor* gatewaySupervisorDescriptor);
28 
29 
30 
36  XDAQ_CONST_CALL xdaq::ApplicationDescriptor* gatewaySupervisorDescriptor_;
37 
41  bool xmlRequestToGateway(cgicc::Cgicc& cgi, std::ostringstream* out, HttpXmlDocument* xmldoc, const AllSupervisorInfo& allSupervisorInfo, WebUsers::RequestUserInfo& userInfo);
42 
43  std::string getActiveUserList (void);
44  void sendSystemMessage (const std::string& toUser, const std::string& message, bool doEmail = false);
45  void sendSystemMessage (const std::string& toUser, const std::string& subject, const std::string& message, bool doEmail = false);
46  void makeSystemLogEntry (const std::string& entryText);
47  std::pair<std::string /*group name*/, TableGroupKey>
48  getLastTableGroup (const std::string& actionOfLastGroup, std::string& returnedActionTimeString);
49  void getLastTableGroups (std::map< std::string /* group type */,
50  std::tuple<std::string /*group name*/, TableGroupKey,
51  std::string /* time string*/>>& theGroups);
52 
53  private:
54 
56  std::string ActiveUserList_;
57  time_t ActiveUserLastUpdateTime_;
58  enum
59  {
60  ACTIVE_USERS_UPDATE_THRESHOLD = 2,
61  };
62 
67  struct CachedCookieCheck
68  {
69  time_t cacheTime;
70  std::string cookieCode;
71  std::string permissions;
72  std::string username;
73  std::string displayName;
74  std::string userWithLock;
75  };
76 
77  std::map<std::string /*originalCookieCode*/, CachedCookieCheck> cookieCheckCache_;
78  std::mutex cookieCheckCacheMutex_;
79 
80  enum
81  {
82  COOKIE_CHECK_CACHE_TTL = 30,
83  };
84 
85 };
86 // clang-format on
87 } // namespace ots
88 
89 #endif
XDAQ_CONST_CALL xdaq::ApplicationDescriptor * gatewaySupervisorDescriptor_
void getLastTableGroups(std::map< std::string, std::tuple< std::string, TableGroupKey, std::string >> &theGroups)
RemoteWebUsers(xdaq::Application *application, XDAQ_CONST_CALL xdaq::ApplicationDescriptor *gatewaySupervisorDescriptor)
std::pair< std::string, TableGroupKey > getLastTableGroup(const std::string &actionOfLastGroup, std::string &returnedActionTimeString)
actionOfLastGroup = "Configured" or "Started", for example
std::string getActiveUserList(void)
void sendSystemMessage(const std::string &toUser, const std::string &message, bool doEmail=false)
void makeSystemLogEntry(const std::string &entryText)
bool xmlRequestToGateway(cgicc::Cgicc &cgi, std::ostringstream *out, HttpXmlDocument *xmldoc, const AllSupervisorInfo &allSupervisorInfo, WebUsers::RequestUserInfo &userInfo)
defines used also by OtsConfigurationWizardSupervisor