otsdaq  v2_03_00
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*) throw(xdaq::exception::Exception);
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) throw(xgi::exception::Exception);
54  void verification(xgi::Input* in, xgi::Output* out) throw(xgi::exception::Exception);
55  void request(xgi::Input* in, xgi::Output* out) throw(xgi::exception::Exception);
56  void requestIcons(xgi::Input* in, xgi::Output* out) throw(xgi::exception::Exception);
57 
58  void editSecurity(xgi::Input* in, xgi::Output* out) throw(xgi::exception::Exception);
59  void UserSettings(xgi::Input* in, xgi::Output* out) throw(xgi::exception::Exception);
60  void tooltipRequest(xgi::Input* in,
61  xgi::Output* out) throw(xgi::exception::Exception);
62  void toggleSecurityCodeGeneration(xgi::Input* in,
63  xgi::Output* out) throw(xgi::exception::Exception);
64  std::string validateUploadFileType(const std::string fileType);
65  void cleanUpPreviews();
66  void savePostPreview(std::string& subject,
67  std::string& text,
68  const std::vector<cgicc::FormFile>& files,
69  std::string creator,
70  HttpXmlDocument* xmldoc = nullptr);
71 
72  // External Supervisor XOAP handlers
73  xoap::MessageReference supervisorSequenceCheck(xoap::MessageReference msg) throw(
74  xoap::exception::Exception);
75  xoap::MessageReference supervisorLastConfigGroupRequest(
76  xoap::MessageReference msg) throw(xoap::exception::Exception);
77 
78  private:
79  std::string securityCode_;
80  bool defaultSequence_;
81  std::vector<std::string> allowedFileUploadTypes_, matchingFileUploadTypes_;
82 
83  std::string supervisorClass_;
84  std::string supervisorClassNoNamespace_;
85 
86  enum
87  {
88  ADMIN_PERMISSIONS_THRESHOLD = 255,
89  EXPERIMENT_NAME_MIN_LENTH = 3,
90  EXPERIMENT_NAME_MAX_LENTH = 25,
91  USER_DATA_EXPIRATION_TIME = 60 * 20, // 20 minutes
92  };
93 };
94 
95 } // namespace ots
96 
97 #endif