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