otsdaq  v2_04_01
WizardSupervisor.h
1 #ifndef _ots_WizardSupervisor_h
2 #define _ots_WizardSupervisor_h
3 
4 #include "otsdaq-core/SOAPUtilities/SOAPMessenger.h"
5 
6 #include <xdaq/Application.h>
7 #include <xgi/Method.h>
8 #include "otsdaq-core/Macros/XDAQApplicationMacros.h"
9 
10 #include <xoap/Method.h>
11 #include <xoap/SOAPBody.h>
12 #include <xoap/SOAPEnvelope.h>
13 #include <xoap/domutils.h>
14 
15 #include <cgicc/HTMLClasses.h>
16 #include <cgicc/HTMLDoctype.h>
17 #include <cgicc/HTTPCookie.h>
18 #include <cgicc/HTTPHeader.h>
19 
20 #include <map>
21 #include <string>
22 
23 #include "otsdaq-core/CodeEditor/CodeEditor.h"
24 #include "otsdaq-core/SupervisorInfo/AllSupervisorInfo.h"
25 
26 namespace ots
27 {
28 class HttpXmlDocument;
29 
30 // WizardSupervisor
31 // This class is a xdaq application.
32 //
33 // It is instantiated by the xdaq context when otsdaq is in "Wiz Mode."
34 //
35 // It is different from the "Normal Mode" Gateway Supervisor in that
36 // it does not have a state machine and does not inherit properties
37 // from CorePropertySupervisorBase. The assumption is that only admins
38 // have access to wiz mode, and they have access to all features of it.
39 class WizardSupervisor : public xdaq::Application, public SOAPMessenger
40 {
41  public:
42  XDAQ_INSTANTIATOR();
43 
44  WizardSupervisor(xdaq::ApplicationStub*);
45  virtual ~WizardSupervisor(void);
46 
47  void init(void);
48  void destroy(void);
49 
50  void generateURL(void);
51  static void printURL(WizardSupervisor* ptr, std::string securityCode);
52 
53  void Default(xgi::Input* in, xgi::Output* out);
54  void verification(xgi::Input* in, xgi::Output* out);
55  void request(xgi::Input* in, xgi::Output* out);
56  void requestIcons(xgi::Input* in, xgi::Output* out);
57 
58  void editSecurity(xgi::Input* in, xgi::Output* out);
59  void UserSettings(xgi::Input* in, xgi::Output* out);
60  void tooltipRequest(xgi::Input* in, xgi::Output* out);
61  void toggleSecurityCodeGeneration(xgi::Input* in, xgi::Output* out);
62  std::string validateUploadFileType(const std::string fileType);
63  void cleanUpPreviews();
64  void savePostPreview(std::string& subject,
65  std::string& text,
66  const std::vector<cgicc::FormFile>& files,
67  std::string creator,
68  HttpXmlDocument* xmldoc = nullptr);
69 
70  // External Supervisor XOAP handlers
71  xoap::MessageReference supervisorSequenceCheck(xoap::MessageReference msg);
72  xoap::MessageReference supervisorLastConfigGroupRequest(xoap::MessageReference msg);
73 
74  private:
75  std::string securityCode_;
76  bool defaultSequence_;
77  std::vector<std::string> allowedFileUploadTypes_, matchingFileUploadTypes_;
78 
79  std::string supervisorClass_;
80  std::string supervisorClassNoNamespace_;
81 
82  enum
83  {
84  ADMIN_PERMISSIONS_THRESHOLD = 255,
85  EXPERIMENT_NAME_MIN_LENTH = 3,
86  EXPERIMENT_NAME_MAX_LENTH = 25,
87  USER_DATA_EXPIRATION_TIME = 60 * 20, // 20 minutes
88  };
89 };
90 
91 } // namespace ots
92 
93 #endif