1 #include "otsdaq/WizardSupervisor/WizardSupervisor.h"
3 #include "otsdaq/CoreSupervisors/CorePropertySupervisorBase.h"
4 #include "otsdaq/GatewaySupervisor/GatewaySupervisor.h"
6 #include "otsdaq/Macros/CoutMacros.h"
7 #include "otsdaq/MessageFacility/ITRACEController.h"
8 #include "otsdaq/MessageFacility/MessageFacility.h"
10 #include <xdaq/NamespaceURI.h>
11 #include "otsdaq/CgiDataUtilities/CgiDataUtilities.h"
12 #include "otsdaq/SOAPUtilities/SOAPCommand.h"
13 #include "otsdaq/SOAPUtilities/SOAPUtilities.h"
14 #include "otsdaq/WebUsersUtilities/WebUsers.h"
15 #include "otsdaq/XmlUtilities/HttpXmlDocument.h"
19 #include <boost/filesystem.hpp>
26 namespace filesystem = boost::filesystem;
31 const std::string WizardSupervisor::WIZ_SUPERVISOR = __ENV__(
"OTS_CONFIGURATION_WIZARD_SUPERVISOR_SERVER");
32 const std::string WizardSupervisor::WIZ_PORT = __ENV__(
"PORT");
33 const std::string WizardSupervisor::SERVICE_DATA_PATH = __ENV__(
"SERVICE_DATA_PATH");
35 #define SECURITY_FILE_NAME WizardSupervisor::SERVICE_DATA_PATH + "/OtsWizardData/security.dat"
36 #define SEQUENCE_FILE_NAME WizardSupervisor::SERVICE_DATA_PATH + "/OtsWizardData/sequence.dat"
37 #define SEQUENCE_OUT_FILE_NAME WizardSupervisor::SERVICE_DATA_PATH + "/OtsWizardData/sequence.out"
38 #define USER_IMPORT_EXPORT_PATH WizardSupervisor::SERVICE_DATA_PATH + "/"
40 #define XML_STATUS "editUserData_status"
42 #define XML_ADMIN_STATUS "logbook_admin_status"
43 #define XML_MOST_RECENT_DAY "most_recent_day"
44 #define XML_EXPERIMENTS_ROOT "experiments"
45 #define XML_EXPERIMENT "experiment"
46 #define XML_ACTIVE_EXPERIMENT "active_experiment"
47 #define XML_EXPERIMENT_CREATE "create_time"
48 #define XML_EXPERIMENT_CREATOR "creator"
50 #define XML_LOGBOOK_ENTRY "logbook_entry"
51 #define XML_LOGBOOK_ENTRY_SUBJECT "logbook_entry_subject"
52 #define XML_LOGBOOK_ENTRY_TEXT "logbook_entry_text"
53 #define XML_LOGBOOK_ENTRY_FILE "logbook_entry_file"
54 #define XML_LOGBOOK_ENTRY_TIME "logbook_entry_time"
55 #define XML_LOGBOOK_ENTRY_CREATOR "logbook_entry_creator"
56 #define XML_LOGBOOK_ENTRY_HIDDEN "logbook_entry_hidden"
57 #define XML_LOGBOOK_ENTRY_HIDER "logbook_entry_hider"
58 #define XML_LOGBOOK_ENTRY_HIDDEN_TIME "logbook_entry_hidden_time"
60 #define XML_PREVIEW_INDEX "preview_index"
61 #define LOGBOOK_PREVIEW_FILE "preview.xml"
66 #define __MF_SUBJECT__ "Wizard"
69 const std::vector<std::string> WizardSupervisor::allowedFileUploadTypes_ = {
78 const std::vector<std::string> WizardSupervisor::matchingFileUploadTypes_ = {
91 WizardSupervisor::WizardSupervisor(xdaq::ApplicationStub* s)
92 : xdaq::Application(s)
94 , supervisorClass_(getApplicationDescriptor()->getClassName())
95 , supervisorClassNoNamespace_(supervisorClass_.substr(
96 supervisorClass_.find_last_of(
":") + 1,
97 supervisorClass_.length() - supervisorClass_.find_last_of(
":")))
99 __COUT__ <<
"Constructor." << __E__;
104 allSupervisorInfo_.init(getApplicationContext());
106 xgi::bind(
this, &WizardSupervisor::Default,
"Default");
107 xgi::bind(
this, &WizardSupervisor::verification,
"Verify");
108 xgi::bind(
this, &WizardSupervisor::request,
"Request");
109 xgi::bind(
this, &WizardSupervisor::requestIcons,
"requestIcons");
110 xgi::bind(
this, &WizardSupervisor::editSecurity,
"editSecurity");
111 xgi::bind(
this, &WizardSupervisor::UserSettings,
"UserSettings");
112 xgi::bind(
this, &WizardSupervisor::tooltipRequest,
"TooltipRequest");
114 &WizardSupervisor::toggleSecurityCodeGeneration,
115 "ToggleSecurityCodeGeneration");
117 &WizardSupervisor::supervisorSequenceCheck,
118 "SupervisorSequenceCheck",
121 &WizardSupervisor::supervisorLastTableGroupRequest,
122 "SupervisorLastTableGroupRequest",
127 GatewaySupervisor::indicateOtsAlive();
129 __COUT__ <<
"Constructed." << __E__;
132 WizardSupervisor::~WizardSupervisor(
void)
134 __COUT__ <<
"Destructor." << __E__;
136 __COUT__ <<
"Destructed." << __E__;
140 void WizardSupervisor::destroy(
void)
146 void WizardSupervisor::init(
void)
149 mkdir((WizardSupervisor::SERVICE_DATA_PATH).c_str(), 0755);
150 mkdir((WizardSupervisor::SERVICE_DATA_PATH +
"/OtsWizardData").c_str(), 0755);
155 void WizardSupervisor::requestIcons(xgi::Input* in, xgi::Output* out)
157 cgicc::Cgicc cgi(in);
162 if(securityCode_.compare(submittedSequence) != 0)
164 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match! "
165 << time(0) << std::endl;
170 __COUT__ <<
"*** Successfully authenticated security sequence @ " << time(0)
184 *out <<
"Configure,CFG,0,1,icon-Configure.png,/urn:xdaq-application:lid=280/,/"
186 <<
",Table Editor,TBL,0,1,icon-ControlsDashboard.png,"
187 "/urn:xdaq-application:lid=280/?configWindowName=tableEditor,/"
189 <<
",Desktop Icon Editor,ICON,0,1,icon-IconEditor.png,"
190 "/WebPath/html/ConfigurationGUI_subset.html?urn=280&subsetBasePath=DesktopIconTable&"
191 "recordAlias=Icons&groupingFieldList=Status%2CFolderPath%2CRequiredPermissionLevel,/"
194 <<
",Edit User Accounts,USER,1,1,"
195 "/WebPath/images/dashboardImages/icon-Settings.png,/WebPath/html/UserSettings.html,/User Settings"
197 <<
",Security Settings,SEC,1,1,icon-SecuritySettings.png,"
198 "/WebPath/html/SecuritySettings.html,/User Settings"
200 <<
",Edit User Data,USER,1,1,icon-EditUserData.png,/WebPath/html/EditUserData.html,/User Settings"
204 <<
",Console,C,1,1,icon-Console.png,/urn:xdaq-application:lid=260/,/"
207 <<
",Front-end Wizard,CFG,0,1,icon-Configure.png,"
208 "/WebPath/html/RecordWiz_ConfigurationGUI.html?urn=280&recordAlias=Front%2Dend,Config Wizards"
210 <<
",Processor Wizard,CFG,0,1,icon-Configure.png,"
211 "/WebPath/html/RecordWiz_ConfigurationGUI.html?urn=280&recordAlias=Processor,Config Wizards"
213 <<
",artdaq Config Editor,CFG,0,1,icon-Configure.png,"
214 "/WebPath/html/ConfigurationGUI_artdaq.html?urn=280,Config Wizards"
216 <<
",Block Diagram,CFG,0,1,icon-Configure.png,"
217 "/WebPath/html/ConfigurationSubsetBlockDiagram.html?urn=280,Config Wizards"
220 <<
",Code Editor,CODE,0,1,icon-CodeEditor.png,/urn:xdaq-application:lid=240/,/"
223 <<
",State Machine Screenshot,FSM-SS,1,1,icon-Physics.gif,"
224 "/WebPath/images/windowContentImages/state_machine_screenshot.png,/Documentation"
227 <<
",Redmine Project for otsdaq,RED,2,1,../otsdaqIcons/android-icon-36x36.png,"
228 "https://cdcvs.fnal.gov/redmine/projects/otsdaq,/Documentation"
230 <<
",Homepage for otsdaq,OTS,2,1,../otsdaqIcons/android-icon-36x36.png,"
231 "https://otsdaq.fnal.gov,/Documentation"
257 void WizardSupervisor::verification(xgi::Input* in, xgi::Output* out)
259 cgicc::Cgicc cgi(in);
261 __COUT__ <<
"submittedSequence=" << submittedSequence <<
" " << time(0) << std::endl;
263 std::string securityWarning =
"";
265 if(securityCode_.compare(submittedSequence) != 0)
267 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match!"
269 *out <<
"Invalid code.";
275 __COUT__ <<
"*** Successfully authenticated security sequence "
276 <<
"@ " << time(0) << std::endl;
281 securityWarning =
"&secure=False";
285 *out <<
"<!DOCTYPE HTML><html lang='en'><head><title>ots wiz</title>"
286 << GatewaySupervisor::getIconHeaderString() <<
289 <<
"<frameset col='100%' row='100%'><frame src='/WebPath/html/Wizard.html?urn="
290 << this->getApplicationDescriptor()->getLocalId() << securityWarning
291 <<
"'></frameset></html>";
295 void WizardSupervisor::generateURL()
297 defaultSequence_ =
true;
300 FILE* fp = fopen((SEQUENCE_FILE_NAME).c_str(),
"r");
303 __COUT_INFO__ <<
"Sequence length file found: " << SEQUENCE_FILE_NAME
306 fgets(line, 100, fp);
307 sscanf(line,
"%d", &length);
312 defaultSequence_ =
false;
318 <<
"(Reverting to default wiz security) Sequence length file NOT found: "
319 << SEQUENCE_FILE_NAME << std::endl;
323 __COUT__ <<
"Sequence length = " << length << std::endl;
327 const char alphanum[] =
329 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
330 "abcdefghijklmnopqrstuvwxyz";
332 for(
int i = 0; i < length; ++i)
334 securityCode_ += alphanum[rand() % (
sizeof(alphanum) - 1)];
337 __COUT__ << WizardSupervisor::WIZ_SUPERVISOR <<
":" << WizardSupervisor::WIZ_PORT
338 <<
"/urn:xdaq-application:lid="
339 << this->getApplicationDescriptor()->getLocalId()
340 <<
"/Verify?code=" << securityCode_ << std::endl;
346 fp = fopen((SEQUENCE_OUT_FILE_NAME).c_str(),
"w");
349 fprintf(fp,
"%s", securityCode_.c_str());
353 __COUT_ERR__ <<
"Sequence output file NOT found: " << SEQUENCE_OUT_FILE_NAME
359 void WizardSupervisor::printURL(
WizardSupervisor* ptr, std::string securityCode)
365 std::this_thread::sleep_for(std::chrono::seconds(2));
366 __COUT__ << WizardSupervisor::WIZ_SUPERVISOR <<
":" << WizardSupervisor::WIZ_PORT
367 <<
"/urn:xdaq-application:lid="
368 << ptr->getApplicationDescriptor()->getLocalId()
369 <<
"/Verify?code=" << securityCode << std::endl;
374 void WizardSupervisor::tooltipRequest(xgi::Input* in, xgi::Output* out)
376 cgicc::Cgicc cgi(in);
384 if(securityCode_.compare(submittedSequence) != 0)
386 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match!"
398 if(Command ==
"check")
406 else if(Command ==
"setNeverShow")
409 WebUsers::DEFAULT_ADMIN_USERNAME,
418 __COUT__ <<
"Command Request, " << Command <<
", not recognized." << std::endl;
424 void WizardSupervisor::toggleSecurityCodeGeneration(xgi::Input* in, xgi::Output* out)
426 cgicc::Cgicc cgi(in);
429 __COUT__ <<
"Got to Command = " << Command << std::endl;
434 if(securityCode_.compare(submittedSequence) != 0)
436 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match!"
442 __COUT__ <<
"***Successfully authenticated security sequence." << std::endl;
448 if(Command ==
"TurnGenerationOn")
450 __COUT__ <<
"Turning automatic URL Generation on with a sequence depth of 16!"
452 std::ofstream outfile((SEQUENCE_FILE_NAME).c_str());
453 outfile <<
"16" << std::endl;
458 std::string securityCode) { printURL(ptr, securityCode); },
463 xmldoc.addTextElementToData(
"Status",
"Generation_Success");
466 __COUT__ <<
"Command Request, " << Command <<
", not recognized." << std::endl;
475 xoap::MessageReference message)
479 parameters.addParameter(
"sequence");
480 SOAPUtilities::receive(message, parameters);
482 std::string submittedSequence = parameters.getValue(
"sequence");
486 std::map<std::string , WebUsers::permissionLevel_t> permissionMap;
488 if(securityCode_ == submittedSequence)
489 permissionMap.emplace(
490 std::pair<std::string /*groupName*/, WebUsers::permissionLevel_t>(
494 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match!"
497 permissionMap.emplace(
498 std::pair<std::string /*groupName*/, WebUsers::permissionLevel_t>(
499 WebUsers::DEFAULT_USER_GROUP, WebUsers::PERMISSION_LEVEL_INACTIVE));
506 return SOAPUtilities::makeSOAPMessageReference(
"SequenceResponse", retParameters);
514 xoap::MessageReference WizardSupervisor::supervisorLastTableGroupRequest(
515 xoap::MessageReference message)
518 parameters.addParameter(
"ActionOfLastGroup");
519 SOAPUtilities::receive(message, parameters);
521 return GatewaySupervisor::lastTableGroupRequestHandler(parameters);
525 void WizardSupervisor::Default(xgi::Input* , xgi::Output* out)
527 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match!"
529 *out <<
"Unauthorized Request.";
533 void WizardSupervisor::request(xgi::Input* in, xgi::Output* out)
535 cgicc::Cgicc cgiIn(in);
540 if(securityCode_.compare(submittedSequence) != 0)
542 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match! "
543 << time(0) << std::endl;
544 *out << WebUsers::REQ_NO_PERMISSION_RESPONSE.c_str();
549 __COUT__ <<
"***Successfully authenticated security sequence. " << time(0)
555 __COUTV__(requestType);
568 if(requestType ==
"gatewayLaunchOTS" || requestType ==
"gatewayLaunchWiz")
573 __COUT_WARN__ << requestType <<
" requestType received! " << __E__;
574 __COUT_WARN__ << requestType <<
" requestType received! " << __E__;
578 if(requestType ==
"gatewayLaunchOTS")
579 GatewaySupervisor::launchStartOTSCommand(
"LAUNCH_OTS", &cfgMgr);
580 else if(requestType ==
"gatewayLaunchWiz")
581 GatewaySupervisor::launchStartOTSCommand(
"LAUNCH_WIZ", &cfgMgr);
583 else if(requestType ==
"addDesktopIcon")
585 GatewaySupervisor::handleAddDesktopIconRequest(
"admin", cgiIn, xmlOut);
587 else if(requestType ==
"getAppId")
589 GatewaySupervisor::handleGetApplicationIdRequest(
590 &allSupervisorInfo_, cgiIn, xmlOut);
592 else if(requestType ==
"getSettings")
596 __COUT__ <<
"Get Settings Request" << __E__;
597 __COUT__ <<
"accounts = " << accounts << __E__;
599 GatewaySupervisor::theWebUsers_.insertSettingsForUser(
600 0 , &xmlOut, accounts ==
"1");
602 else if(requestType ==
"accountSettings")
608 if(type ==
"updateAccount")
609 type_int = GatewaySupervisor::theWebUsers_.MOD_TYPE_UPDATE;
610 else if(type ==
"createAccount")
611 type_int = GatewaySupervisor::theWebUsers_.MOD_TYPE_ADD;
612 else if(type ==
"deleteAccount")
613 type_int = GatewaySupervisor::theWebUsers_.MOD_TYPE_DELETE;
621 __COUT__ <<
"accountSettings Request" << __E__;
622 __COUT__ <<
"type = " << type <<
" - " << type_int << __E__;
623 __COUT__ <<
"username = " << username << __E__;
624 __COUT__ <<
"useremail = " << email << __E__;
625 __COUT__ <<
"displayname = " << displayname << __E__;
626 __COUT__ <<
"permissions = " << permissions << __E__;
628 GatewaySupervisor::theWebUsers_.modifyAccountSettings(
629 0 , type_int, username, displayname, email, permissions);
631 __COUT__ <<
"accounts = " << accounts << __E__;
633 GatewaySupervisor::theWebUsers_.insertSettingsForUser(
634 0 , &xmlOut, accounts ==
"1");
638 __SS__ <<
"requestType Request '" << requestType <<
"' not recognized."
643 catch(
const std::runtime_error& e)
645 __SS__ <<
"An error was encountered handling requestType '" << requestType
646 <<
"':" << e.what() << __E__;
647 __COUT__ <<
"\n" << ss.str();
648 xmlOut.addTextElementToData(
"Error", ss.str());
652 __SS__ <<
"An unknown error was encountered handling requestType '" << requestType
654 <<
"Please check the printouts to debug." << __E__;
659 catch(
const std::exception& e)
661 ss <<
"Exception message: " << e.what();
666 __COUT__ <<
"\n" << ss.str();
667 xmlOut.addTextElementToData(
"Error", ss.str());
672 unsigned int occurance = 0;
676 __COUT_ERR__ <<
"'" << requestType <<
"' ERROR encountered: " << err << __E__;
677 __COUT_ERR__ <<
"'" << requestType <<
"' ERROR encountered: " << err << __E__;
684 (std::ostringstream*)out,
691 void WizardSupervisor::editSecurity(xgi::Input* in, xgi::Output* out)
694 cgicc::Cgicc cgi(in);
699 if(securityCode_.compare(submittedSequence) != 0)
701 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match!"
707 __COUT__ <<
"***Successfully authenticated security sequence." << std::endl;
711 if(submittedSecurity !=
"")
713 __COUT__ <<
"Selection exists!" << std::endl;
714 __COUT__ << submittedSecurity << std::endl;
716 if(submittedSecurity ==
"ResetAllUserData")
718 WebUsers::deleteUserData();
719 __COUT__ <<
"Turning URL Generation back to default!" << std::endl;
722 std::ofstream newFile((SEQUENCE_FILE_NAME).c_str());
723 newFile <<
"4" << std::endl;
728 std::string securityCode) { printURL(ptr, securityCode); },
732 *out <<
"Default_URL_Generation";
734 else if(submittedSecurity ==
"ResetAllUserTooltips")
737 *out << submittedSecurity;
740 else if(submittedSecurity == WebUsers::SECURITY_TYPE_DIGEST_ACCESS ||
741 submittedSecurity == WebUsers::SECURITY_TYPE_NONE)
744 mkdir((WizardSupervisor::SERVICE_DATA_PATH).c_str(), 0755);
745 mkdir((WizardSupervisor::SERVICE_DATA_PATH +
"/OtsWizardData").c_str(), 0755);
747 std::ofstream writeSecurityFile;
749 writeSecurityFile.open((SECURITY_FILE_NAME).c_str());
750 if(writeSecurityFile.is_open())
751 writeSecurityFile << submittedSecurity;
754 __COUT_ERR__ <<
"Error writing file!" << std::endl;
759 writeSecurityFile.close();
763 __COUT_ERR__ <<
"Invalid submittedSecurity string: " << submittedSecurity
772 std::ifstream securityFile;
773 std::string security;
775 securityFile.open((SECURITY_FILE_NAME).c_str());
776 if(securityFile.is_open())
778 std::getline(securityFile, security);
779 securityFile.close();
783 WebUsers::SECURITY_TYPE_DEFAULT;
791 void WizardSupervisor::UserSettings(xgi::Input* in, xgi::Output* out)
794 cgicc::Cgicc cgi(in);
796 std::string securityFileName = SECURITY_FILE_NAME;
799 Command = cgi(
"RequestType");
801 __COUT__ << Command << std::endl;
802 __COUT__ <<
"We are viewing Users' Settings!" << std::endl;
805 if(securityCode_.compare(submittedSequence) != 0)
807 __COUT__ <<
"Unauthorized Request made, security sequence doesn't match!"
809 __COUT__ << submittedSequence << std::endl;
814 __COUT__ <<
"***Successfully authenticated security sequence." << std::endl;
825 __COUT__ <<
"Action exists!" << std::endl;
826 __COUT__ << Command << std::endl;
828 if(Command ==
"Import")
850 std::string pathToTemporalFolder = USER_IMPORT_EXPORT_PATH +
"tmp/";
851 filesystem::path temporaryPath = pathToTemporalFolder;
853 if(filesystem::exists(temporaryPath))
854 __COUT__ << temporaryPath <<
" exists!" << std::endl;
857 __COUT__ << temporaryPath <<
" does not exist! Creating it now. "
859 filesystem::create_directory(temporaryPath);
863 const std::vector<cgicc::FormFile> files = cgi.getFiles();
867 for(
unsigned int i = 0; i < files.size(); ++i)
869 std::string filename = pathToTemporalFolder + files[i].getFilename();
872 std::size_t tarFoundFlag = filename.find(
".tar");
873 std::size_t tarGzFoundFlag = filename.find(
"gz");
874 std::size_t tarBzFoundFlag = filename.find(
"bz2");
876 if(tarFoundFlag != std::string::npos)
878 if(tarGzFoundFlag != std::string::npos ||
879 tarBzFoundFlag != std::string::npos)
882 <<
"This is not a valid tar file, due to bad extension naming"
884 __COUT_ERR__ <<
"\n" << ss.str();
888 std::ofstream myFile;
889 myFile.open(filename.c_str());
890 files[0].writeToStream(myFile);
891 std::string commandToDecompressUserData =
892 std::string(
"tar -xvf ") + filename;
893 filesystem::current_path(USER_IMPORT_EXPORT_PATH);
894 system(commandToDecompressUserData.c_str());
901 __SS__ <<
"This is not a valid tar file for user preferences"
903 __COUT_ERR__ <<
"\n" << ss.str();
919 else if(Command ==
"Export")
927 std::string pathToTemporalFolder = USER_IMPORT_EXPORT_PATH +
"tmp/";
928 filesystem::path temporaryPath = pathToTemporalFolder;
930 if(filesystem::exists(temporaryPath))
931 __COUT__ << temporaryPath <<
" exists!" << std::endl;
934 __COUT__ << temporaryPath <<
" does not exist! Creating it now. "
936 filesystem::create_directory(temporaryPath);
938 std::string commandToCompressUserData =
939 std::string(
"tar -cvf user_settings.tar ") +
940 std::string(
"ActiveTableGroups.cfg ") +
941 std::string(
"ConsolePreferences ") +
942 std::string(
"CoreTableInfoNames.dat ") + std::string(
"LoginData ") +
943 std::string(
"OtsWizardData ") + std::string(
"ProgressBarData ");
945 filesystem::current_path(USER_IMPORT_EXPORT_PATH);
946 system(commandToCompressUserData.c_str());
947 filesystem::rename(
"user_settings.tar",
"tmp/user_settings.tar");
948 filesystem::current_path(temporaryPath);
949 __COUT__ << system(
"echo You can find the output on the following path ")
951 __COUT__ << system(
"pwd") << std::endl;
955 __COUT__ <<
"Command request not recognized: " << Command << std::endl;
968 std::string WizardSupervisor::validateUploadFileType(
const std::string fileType)
970 for(
unsigned int i = 0; i < allowedFileUploadTypes_.size(); ++i)
971 if(allowedFileUploadTypes_[i] == fileType)
972 return matchingFileUploadTypes_[i];
981 void WizardSupervisor::cleanUpPreviews()
983 std::string userData = (std::string)USER_IMPORT_EXPORT_PATH;
985 DIR* dir = opendir(userData.c_str());
988 __COUT__ <<
"Error - User Data directory missing: " << userData << std::endl;
992 struct dirent* entry;
993 time_t dirCreateTime;
1000 if(strcmp(entry->d_name,
".") != 0 && strcmp(entry->d_name,
"..") != 0 &&
1001 strcmp(entry->d_name,
".svn") != 0)
1004 for(i = 0; i < strlen(entry->d_name); ++i)
1005 if(entry->d_name[i] ==
'_')
1007 entry->d_name[i] =
' ';
1010 sscanf(entry->d_name,
"%li", &dirCreateTime);
1012 if((time(0) - dirCreateTime) > USER_DATA_EXPIRATION_TIME)
1014 __COUT__ <<
"Expired" << std::endl;
1016 entry->d_name[i] =
'_';
1018 __COUT__ <<
"rm -rf "
1019 << USER_IMPORT_EXPORT_PATH + (std::string)entry->d_name
1022 system(((std::string)(
"rm -rf " + userData + (std::string)entry->d_name))
1034 void WizardSupervisor::savePostPreview(std::string& ,
1036 const std::vector<cgicc::FormFile>& ,
1051 std::string userDataPath =
1052 (std::string)USER_IMPORT_EXPORT_PATH + (std::string)fileIndex;
1054 __COUT__ <<
"userDataPath " << userDataPath << std::endl;
1055 if(-1 == mkdir(userDataPath.c_str(), 0755))
1058 xmldoc->addTextElementToData(XML_STATUS,
1059 "Failed - directory could not be generated.");
static std::string postData(cgicc::Cgicc &cgi, const std::string &needle)
static std::string getData(cgicc::Cgicc &cgi, const std::string &needle)
void outputXmlDocument(std::ostringstream *out, bool dispStdOut=false, bool allowWhiteSpace=false)
std::string getMatchingValue(const std::string &field, const unsigned int occurance=0)
static void resetAllUserTooltips(const std::string &userNeedle="*")
WebUsers::resetAllUserTooltips.
static void tooltipSetNeverShowForUsername(const std::string &username, HttpXmlDocument *xmldoc, const std::string &srcFile, const std::string &srcFunc, const std::string &srcId, bool doNeverShow, bool temporarySilence)
static void tooltipCheckForUsername(const std::string &username, HttpXmlDocument *xmldoc, const std::string &srcFile, const std::string &srcFunc, const std::string &srcId)
@ PERMISSION_LEVEL_ADMIN
max permission level!
xoap::MessageReference supervisorSequenceCheck(xoap::MessageReference message)
External Supervisor XOAP handlers.
void INIT_MF(const char *name)
static std::string mapToString(const std::map< std::string, T > &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ")