$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include "otsdaq-core/WebUsersUtilities/RemoteWebUsers.h" 00002 00003 #include "otsdaq-core/CgiDataUtilities/CgiDataUtilities.h" 00004 #include "otsdaq-core/SOAPUtilities/SOAPCommand.h" 00005 #include "otsdaq-core/SOAPUtilities/SOAPParameters.h" //must include in .h for static function 00006 #include "otsdaq-core/SOAPUtilities/SOAPUtilities.h" 00007 #include "otsdaq-core/XmlUtilities/HttpXmlDocument.h" 00008 00009 #include <cstdio> 00010 #include <cstdlib> 00011 #include <vector> 00012 00013 #include "otsdaq-core/SupervisorInfo/AllSupervisorInfo.h" 00014 00015 using namespace ots; 00016 00017 #undef __MF_SUBJECT__ 00018 #define __MF_SUBJECT__ "RemoteWebUsers" 00019 00020 //======================================================================================================================== 00021 // User Notes: 00022 // - use xmlRequestGateway to check security from outside the Supervisor and Wizard 00023 // 00024 // Example usage: 00025 // 00026 // 00027 // 00028 // void exampleClass::exampleRequestHandler(xgi::Input * in, xgi::Output * out) 00029 // 00030 // { 00031 // cgicc::Cgicc cgi(in); 00032 // 00033 // //... 00034 // 00035 // HttpXmlDocument xmldoc; 00036 // std::string userWithLock, userName, displayName; 00037 // uint64_t activeSessionIndex; 00038 // uint8_t userPermissions; 00039 // 00040 // //**** start LOGIN GATEWAY CODE ***// 00041 // //check cookieCode, sequence, userWithLock, and permissions access all in 00042 // one shot! 00043 // { 00044 // bool automaticCommand = 0; //automatic commands should not refresh 00045 // cookie code.. only user initiated commands should! bool checkLock = 00046 // true; bool lockRequired = true; 00047 // 00048 // if(!theRemoteWebUsers_.xmlRequestToGateway( 00049 // cgi,out,&xmldoc,theSupervisorsConfiguration_ 00050 // ,&userPermissions //acquire user's access level 00051 //(optionally null pointer)// 00052 // ,!automaticCommand //true/false refresh cookie code 00053 // ,USER_PERMISSIONS_THRESHOLD //set access level requirement to 00054 // pass gateway 00055 // ,checkLock //true/false enable check that 00056 // system is unlocked or this user has the lock ,lockRequired 00058 // ,&userWithLock //acquire username with lock 00059 //(optionally null pointer) 00060 // ,&userName //acquire username of this user 00061 //(optionally 00062 // null pointer) ,0//,&displayName //acquire user's 00063 // Display Name 00064 // ,0//,&activeSessionIndex //acquire user's session index 00065 // associated with the cookieCode 00066 // )) 00067 // { //failure 00068 // //std::cout << out->str() << std::endl; //could print out return 00069 // string on failure return; 00070 // } 00071 // } 00072 // //done checking cookieCode, sequence, userWithLock, and permissions access 00073 // all in one shot! 00074 // //**** end LOGIN GATEWAY CODE ***// 00075 // 00076 // //Success! if here. 00077 // // 00078 // //... use acquired values below 00079 // //... 00080 // 00081 // //add to xml document, for example: 00082 // //DOMElement* parentEl; 00083 // //parentEl = xmldoc.addTextElementToData("ExampleTag", "parent-data"); 00084 // //xmldoc.addTextElementToParent("ExampleChild", "child-data", parentEl); 00085 // 00086 // //return xml doc holding server response 00087 // //xmldoc.outputXmlDocument((std::ostringstream*) out, true); //true to 00088 // also print to std::cout 00089 // } 00090 // 00091 // 00092 //======================================================================================================================== 00093 00094 RemoteWebUsers::RemoteWebUsers(xdaq::Application* application) 00095 : SOAPMessenger(application) 00096 { 00097 ActiveUserLastUpdateTime_ = 0; // init to never 00098 ActiveUserList_ = ""; // init to empty 00099 } 00100 00101 //======================================================================================================================== 00102 // xmlRequestGateway 00103 // if false, user code should just return.. out is handled on false; on true, out is 00104 // untouched 00105 bool RemoteWebUsers::xmlRequestToGateway(cgicc::Cgicc& cgi, 00106 std::ostringstream* out, 00107 HttpXmlDocument* xmldoc, 00108 const AllSupervisorInfo& allSupervisorInfo, 00109 WebUsers::RequestUserInfo& userInfo) 00110 { 00111 //__COUT__ << std::endl; 00112 // initialize user info parameters to failed results 00113 WebUsers::initializeRequestUserInfo(cgi, userInfo); 00114 00115 // const_cast away the const 00116 // so that this line is compatible with slf6 and slf7 versions of xdaq 00117 // where they changed to XDAQ_CONST_CALL xdaq::ApplicationDescriptor* in slf7 00118 // 00119 // XDAQ_CONST_CALL is defined in "otsdaq-core/Macros/CoutMacros.h" 00120 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* gatewaySupervisor; 00121 00122 SOAPParameters parameters; 00123 xoap::MessageReference retMsg; 00124 00125 //**** start LOGIN GATEWAY CODE ***// 00126 // If TRUE, cookie code is good, and refreshed code is in cookieCode 00127 // Else, error message is returned in cookieCode 00128 // tmpCookieCode_ = CgiDataUtilities::getOrPostData(cgi,"CookieCode"); //from GET or 00129 // POST 00130 00131 // __COUT__ << cookieCode.length() << std::endl; 00132 // __COUT__ << "cookieCode=" << cookieCode << std::endl; 00133 //__COUT__ << std::endl; 00134 00136 // have CookieCode, try it out 00137 if(allSupervisorInfo.isWizardMode()) 00138 { 00139 // if missing CookieCode... check if in Wizard mode and using sequence 00140 std::string sequence = 00141 CgiDataUtilities::getOrPostData(cgi, "sequence"); // from GET or POST 00142 //__COUT__ << "sequence=" << sequence << std::endl; 00143 if(!sequence.length()) 00144 { 00145 __COUT_ERR__ << "Invalid access attempt (@" << userInfo.ip_ << ")." 00146 << std::endl; 00147 *out << WebUsers::REQ_NO_LOGIN_RESPONSE; 00148 // invalid cookie and also invalid sequence 00149 goto HANDLE_ACCESS_FAILURE; // return false, access failed 00150 } 00151 00152 // have sequence, try it out 00153 00154 gatewaySupervisor = allSupervisorInfo.getWizardInfo().getDescriptor(); 00155 if(!gatewaySupervisor) 00156 { 00157 __COUT_ERR__ << "Missing wizard supervisor." << std::endl; 00158 *out << WebUsers::REQ_NO_LOGIN_RESPONSE; 00159 // sequence code present, but no wizard supervisor 00160 goto HANDLE_ACCESS_FAILURE; // return false, access failed 00161 } 00162 00163 parameters.addParameter("sequence", sequence); 00164 parameters.addParameter("IPAddress", userInfo.ip_); 00165 retMsg = SOAPMessenger::sendWithSOAPReply( 00166 gatewaySupervisor, "SupervisorSequenceCheck", parameters); 00167 parameters.clear(); 00168 parameters.addParameter("Permissions"); 00169 SOAPUtilities::receive(retMsg, parameters); 00170 00171 userInfo.setGroupPermissionLevels(parameters.getValue("Permissions")); 00172 00173 if(WebUsers::checkRequestAccess( 00174 cgi, out, xmldoc, userInfo, true /*isWizardMode*/)) 00175 return true; 00176 else 00177 goto HANDLE_ACCESS_FAILURE; // return false, access failed 00178 00179 // if(userInfo.permissionLevel_ < userInfo.permissionsThreshold_) 00180 // { 00181 // *out << WebUsers::REQ_NO_LOGIN_RESPONSE; 00182 // __COUT__ << "User (@" << userInfo.ip_ << ") has insufficient 00183 // permissions: " << userInfo.permissionLevel_ << "<" << 00184 // userInfo.permissionsThreshold_ << std::endl; 00185 // return false; //invalid cookie and present sequence, but not correct 00186 // sequence 00187 // } 00188 // 00189 // userInfo.setUsername("admin"); 00190 // userInfo.setDisplayName("Admin"); 00191 // userInfo.setUsernameWithLock("admin"); 00192 // userInfo.setActiveUserSessionIndex(0); 00193 // userInfo.setGroupMemebership("admin"); 00194 // 00195 // return true; //successful sequence login! 00196 } 00197 00198 // else proceed with inquiry to Gateway Supervisor 00199 00200 gatewaySupervisor = allSupervisorInfo.getGatewayInfo().getDescriptor(); 00201 00202 if(!gatewaySupervisor) 00203 { 00204 __COUT_ERR__ << "Missing gateway supervisor." << std::endl; 00205 *out << WebUsers::REQ_NO_LOGIN_RESPONSE; 00206 goto HANDLE_ACCESS_FAILURE; // return false, access failed 00207 } 00208 00209 //__COUT__ << std::endl; 00210 00211 parameters.clear(); 00212 parameters.addParameter("CookieCode", userInfo.cookieCode_); 00213 parameters.addParameter("RefreshOption", userInfo.automatedCommand_ ? "0" : "1"); 00214 parameters.addParameter("IPAddress", userInfo.ip_); 00215 00216 retMsg = SOAPMessenger::sendWithSOAPReply( 00217 gatewaySupervisor, "SupervisorCookieCheck", parameters); 00218 00219 parameters.clear(); 00220 parameters.addParameter("CookieCode"); 00221 parameters.addParameter("Permissions"); 00222 parameters.addParameter("UserGroups"); 00223 parameters.addParameter("UserWithLock"); 00224 parameters.addParameter("Username"); 00225 parameters.addParameter("DisplayName"); 00226 parameters.addParameter("ActiveSessionIndex"); 00227 SOAPUtilities::receive(retMsg, parameters); 00228 00229 //__COUT__ << std::endl; 00230 00231 // first extract a few things always from parameters 00232 // like permissionLevel for this request... must consider allowed groups!! 00233 userInfo.setGroupPermissionLevels(parameters.getValue("Permissions")); 00234 userInfo.cookieCode_ = parameters.getValue("CookieCode"); 00235 userInfo.username_ = parameters.getValue("Username"); 00236 userInfo.displayName_ = parameters.getValue("DisplayName"); 00237 userInfo.usernameWithLock_ = parameters.getValue("UserWithLock"); 00238 userInfo.activeUserSessionIndex_ = 00239 strtoul(parameters.getValue("ActiveSessionIndex").c_str(), 0, 0); 00240 00241 if(!WebUsers::checkRequestAccess(cgi, out, xmldoc, userInfo)) 00242 goto HANDLE_ACCESS_FAILURE; // return false, access failed 00243 // else successful access request! 00244 00245 return true; // request granted 00246 // if(!userInfo.checkLock_ && !userInfo.requireLock_) 00247 // return true; //done, no need to get user info for this cookie 00248 // code 00249 // 00250 00252 // get user info for cookie code and check lock (now that username is available) 00253 00254 // parameters.clear(); 00255 // parameters.addParameter("CookieCode",userInfo.cookieCode_); 00256 // retMsg = SOAPMessenger::sendWithSOAPReply(gatewaySupervisor, 00257 // "SupervisorGetUserInfo", parameters); 00258 // 00259 // parameters.clear(); 00260 // parameters.addParameter("Username"); 00261 // parameters.addParameter("DisplayName"); 00262 // parameters.addParameter("ActiveSessionIndex"); 00263 // SOAPUtilities::receive(retMsg, parameters); 00264 00265 // if(WebUsers::finalizeRequestAccess(out,xmldoc,userInfo, 00266 // parameters.getValue("Username"), 00267 // parameters.getValue("DisplayName"), 00268 // strtoul(parameters.getValue("ActiveSessionIndex").c_str(),0,0))) 00269 // return true; 00270 // else 00271 // goto HANDLE_ACCESS_FAILURE; //return false, access failed 00272 00273 HANDLE_ACCESS_FAILURE: 00274 00275 // print out return string on failure 00276 if(!userInfo.automatedCommand_) 00277 __COUT_ERR__ << "Failed request (requestType = " << userInfo.requestType_ 00278 << "): " << out->str() << __E__; 00279 return false; // access failed 00280 00281 // tmpUserWithLock_ = parameters.getValue("UserWithLock"); 00282 // tmpUserGroups_ = parameters.getValue("UserGroups"); 00283 // sscanf(parameters.getValue("Permissions").c_str(),"%hhu",&userInfo.permissionLevel_); 00285 // userInfo.setGroupMemebership(parameters.getValue("UserGroups")); 00286 // tmpCookieCode_ = parameters.getValue("CookieCode"); 00287 00288 // else access granted 00289 00290 //__COUT__ << "cookieCode=" << cookieCode << std::endl; 00291 // 00292 // if(!allowNoUser && cookieCode.length() != WebUsers::COOKIE_CODE_LENGTH) 00293 // { 00294 // __COUT__ << "User (@" << ip << ") has invalid cookie code: " << cookieCode << 00295 // std::endl; *out << WebUsers::REQ_NO_LOGIN_RESPONSE; return false; 00297 // } 00298 // 00299 // if(!allowNoUser && tmpUserPermissions_ < permissionsThreshold) 00300 // { 00301 // *out << WebUsers::REQ_NO_PERMISSION_RESPONSE; 00302 // __COUT__ << "User (@" << ip << ") has insufficient permissions: " << 00303 // tmpUserPermissions_ << "<" << permissionsThreshold << std::endl; 00304 // return false; 00305 // } 00306 00307 // check group membership 00308 // if(!allowNoUser) 00309 // { 00310 // //check groups allowed 00311 // // i.e. if user is a member of one of the groups allowed 00312 // // then grant access 00313 // 00314 // std::set<std::string> userMembership; 00315 // StringMacros::getSetFromString( 00316 // tmpUserGroups_, 00317 // userMembership); 00318 // 00319 // bool accept = false; 00320 // for(const auto& userGroup:userMembership) 00321 // if(StringMacros::inWildCardSet( 00322 // userGroup, 00323 // groupsAllowed)) 00324 // { 00325 // accept = true; 00326 // break; 00327 // } 00328 // 00329 // if(!accept && userMembership.size()) 00330 // { 00331 // *out << WebUsers::REQ_NO_PERMISSION_RESPONSE; 00332 // std::stringstream ss; 00333 // bool first = true; 00334 // for(const auto& group:groupsAllowed) 00335 // if(first && (first=false)) 00336 // ss << group; 00337 // else 00338 // ss << " | " << group; 00339 // 00340 // __COUT__ << "User (@" << ip << ") has insufficient group permissions: " << 00341 // tmpUserGroups_ << " != " << ss.str() << std::endl; return 00342 // false; 00343 // } 00344 // 00345 // //if no access groups specified, then check groups disallowed 00346 // if(!userMembership.size()) 00347 // { 00348 // for(const auto& userGroup:userMembership) 00349 // if(StringMacros::inWildCardSet( 00350 // userGroup, 00351 // groupsDisallowed)) 00352 // { 00353 // *out << WebUsers::REQ_NO_PERMISSION_RESPONSE; 00354 // std::stringstream ss; 00355 // bool first = true; 00356 // for(const auto& group:groupsDisallowed) 00357 // if(first && (first=false)) 00358 // ss << group; 00359 // else 00360 // ss << " | " << group; 00361 // 00362 // __COUT__ << "User (@" << ip << ") is in in a disallowed group 00363 // permissions: 00364 //" << tmpUserGroups_ << " == " << ss.str() << std::endl; 00365 // return false; 00366 // } 00367 // } 00368 // } //end group membership check 00369 // 00370 // if(xmldoc) //fill with cookie code tag 00371 // { 00372 // if(!allowNoUser) 00373 // xmldoc->setHeader(cookieCode); 00374 // else 00375 // xmldoc->setHeader(WebUsers::REQ_ALLOW_NO_USER); 00376 // } 00377 // 00378 // 00379 // 00380 // if(!userName && !displayName && !activeSessionIndex && !checkLock && 00382 // 00383 // //__COUT__ << "User with Lock: " << tmpUserWithLock_ << std::endl; 00384 // 00385 // 00386 // ///////////////////////////////////////////////////// 00387 // //get user info 00388 // parameters.clear(); 00389 // parameters.addParameter("CookieCode",cookieCode); 00390 // retMsg = SOAPMessenger::sendWithSOAPReply(gatewaySupervisor, 00391 // "SupervisorGetUserInfo", parameters); 00392 // 00393 // parameters.clear(); 00394 // parameters.addParameter("Username"); 00395 // parameters.addParameter("DisplayName"); 00396 // parameters.addParameter("ActiveSessionIndex"); 00397 // SOAPUtilities::receive(retMsg, parameters); 00398 // 00399 // 00400 // 00401 // 00402 // userInfo.setActiveUserSessionIndex(0); 00403 // 00404 // 00405 // tmpUsername_ = parameters.getValue("Username"); 00406 // userInfo.setUsername(tmpUsername_); 00407 // userInfo.setDisplayName(parameters.getValue("DisplayName")); 00408 // userInfo.setActiveUserSessionIndex( 00409 // strtoul(parameters.getValue("ActiveSessionIndex").c_str(),0,0)); 00410 // 00411 // if(userInfo.checkLock_ && tmpUserWithLock_ != "" && tmpUserWithLock_ != 00412 // tmpUsername_) 00413 // { 00414 // *out << WebUsers::REQ_USER_LOCKOUT_RESPONSE; 00415 // __COUT__ << "User " << tmpUsername_ << " is locked out. " << tmpUserWithLock_ 00416 //<< " has lock." << std::endl; return false; 00417 // } 00418 // 00419 // if(userInfo.lockRequired_ && tmpUserWithLock_ != tmpUsername_) 00420 // { 00421 // *out << WebUsers::REQ_LOCK_REQUIRED_RESPONSE; 00422 // __COUT__ << "User " << tmpUsername_ << " must have lock to proceed. (" << 00423 // tmpUserWithLock_ << " has lock.)" << std::endl; return false; 00424 // } 00425 // 00426 // return true; 00427 } 00428 00429 //======================================================================================================================== 00430 // getActiveUserList 00431 // if lastUpdateTime is not too recent as spec'd by ACTIVE_USERS_UPDATE_THRESHOLD 00432 // if server responds with 00433 std::string RemoteWebUsers::getActiveUserList( 00434 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* supervisorDescriptor) 00435 { 00436 if(1 || time(0) - ActiveUserLastUpdateTime_ > 00437 ACTIVE_USERS_UPDATE_THRESHOLD) // need to update 00438 { 00439 __COUT__ << "Need to update " << std::endl; 00440 00441 xoap::MessageReference retMsg = ots::SOAPMessenger::sendWithSOAPReply( 00442 supervisorDescriptor, "SupervisorGetActiveUsers"); 00443 00444 SOAPParameters retParameters("UserList"); 00445 SOAPUtilities::receive(retMsg, retParameters); 00446 00447 ActiveUserLastUpdateTime_ = time(0); 00448 return (ActiveUserList_ = retParameters.getValue("UserList")); 00449 } 00450 else 00451 return ActiveUserList_; 00452 } 00453 00454 //======================================================================================================================== 00455 // getLastConfigGroup 00456 // request last "Configured" or "Started" group, for example 00457 // returns empty "" for actionTimeString on failure 00458 // returns "Wed Dec 31 18:00:01 1969 CST" for actionTimeString (in CST) if action never 00459 // has occurred 00460 std::pair<std::string /*group name*/, TableGroupKey> RemoteWebUsers::getLastConfigGroup( 00461 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* supervisorDescriptor, 00462 const std::string& actionOfLastGroup, 00463 std::string& actionTimeString) 00464 { 00465 actionTimeString = ""; 00466 xoap::MessageReference retMsg = ots::SOAPMessenger::sendWithSOAPReply( 00467 supervisorDescriptor, 00468 "SupervisorLastConfigGroupRequest", 00469 SOAPParameters("ActionOfLastGroup", actionOfLastGroup)); 00470 00471 SOAPParameters retParameters; 00472 retParameters.addParameter("GroupName"); 00473 retParameters.addParameter("GroupKey"); 00474 retParameters.addParameter("GroupAction"); 00475 retParameters.addParameter("GroupActionTime"); 00476 SOAPUtilities::receive(retMsg, retParameters); 00477 00478 std::pair<std::string /*group name*/, TableGroupKey> theGroup; 00479 if(retParameters.getValue("GroupAction") != 00480 actionOfLastGroup) // if action doesn't match.. weird 00481 { 00482 __COUT_WARN__ << "Returned group action '" 00483 << retParameters.getValue("GroupAction") 00484 << "' does not match requested group action '" << actionOfLastGroup 00485 << ".'" << std::endl; 00486 return theGroup; // return empty and invalid 00487 } 00488 // else we have an action match 00489 00490 theGroup.first = retParameters.getValue("GroupName"); 00491 theGroup.second = strtol(retParameters.getValue("GroupKey").c_str(), 0, 0); 00492 actionTimeString = retParameters.getValue("GroupActionTime"); 00493 return theGroup; 00494 } 00495 00496 //======================================================================================================================== 00497 // getUserInfoForCookie 00498 // get username and display name for user based on cookie code 00499 // return true, if user info gotten successfully 00500 // else false 00501 bool RemoteWebUsers::getUserInfoForCookie( 00502 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* supervisorDescriptor, 00503 std::string& cookieCode, 00504 std::string* userName, 00505 std::string* displayName, 00506 uint64_t* activeSessionIndex) 00507 { 00508 __COUT__ << std::endl; 00509 if(cookieCode.length() != WebUsers::COOKIE_CODE_LENGTH) 00510 return false; // return if invalid cookie code 00511 00512 // SOAPParametersV parameters(1); 00513 // parameters[0].setName("CookieCode"); parameters[0].setValue(cookieCode); 00514 xoap::MessageReference retMsg = 00515 SOAPMessenger::sendWithSOAPReply(supervisorDescriptor, 00516 "SupervisorGetUserInfo", 00517 SOAPParameters("CookieCode", cookieCode)); 00518 00519 SOAPParameters retParameters; 00520 retParameters.addParameter("Username"); 00521 retParameters.addParameter("DisplayName"); 00522 retParameters.addParameter("ActiveSessionIndex"); 00523 SOAPUtilities::receive(retMsg, retParameters); 00524 if(userName) 00525 *userName = retParameters.getValue("Username"); 00526 if(displayName) 00527 *displayName = retParameters.getValue("DisplayName"); 00528 if(activeSessionIndex) 00529 *activeSessionIndex = 00530 strtoul(retParameters.getValue("ActiveSessionIndex").c_str(), 0, 0); 00531 00532 __COUT__ << "userName " << *userName << std::endl; 00533 00534 return true; 00535 } 00536 00537 //======================================================================================================================== 00538 // cookieCodeIsActiveForRequest 00539 // for external supervisors to check with Supervisor for login 00540 bool RemoteWebUsers::cookieCodeIsActiveForRequest( 00541 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* supervisorDescriptor, 00542 std::string& cookieCode, 00543 uint8_t* userPermissions, 00544 std::string ip, 00545 bool refreshCookie, 00546 std::string* userWithLock) 00547 { 00548 //__COUT__ << "CookieCode: " << cookieCode << " " << cookieCode.length() << std::endl; 00549 if(cookieCode.length() != WebUsers::COOKIE_CODE_LENGTH) 00550 return false; // return if invalid cookie code 00551 00552 // 00553 00554 SOAPParameters parameters; 00555 parameters.addParameter("CookieCode", cookieCode); 00556 parameters.addParameter("RefreshOption", refreshCookie ? "1" : "0"); 00557 00558 //__COUT__ << "CookieCode: " << cookieCode << std::endl; 00559 xoap::MessageReference retMsg = SOAPMessenger::sendWithSOAPReply( 00560 supervisorDescriptor, "SupervisorCookieCheck", parameters); 00561 00562 SOAPParameters retParameters; 00563 retParameters.addParameter("CookieCode"); 00564 retParameters.addParameter("Permissions"); 00565 retParameters.addParameter("UserWithLock"); 00566 SOAPUtilities::receive(retMsg, retParameters); 00567 00568 if(userWithLock) 00569 *userWithLock = retParameters.getValue("UserWithLock"); 00570 if(userPermissions) 00571 sscanf(retParameters.getValue("Permissions").c_str(), 00572 "%hhu", 00573 userPermissions); // unsigned char 00574 00575 cookieCode = retParameters.getValue("CookieCode"); 00576 00577 return cookieCode.length() == 00578 WebUsers::COOKIE_CODE_LENGTH; // proper cookieCode has length 00579 // WebUsers::COOKIE_CODE_LENGTH 00580 } 00581 //======================================================================================================================== 00582 // sendSystemMessage 00583 // send system message to toUser through Supervisor 00584 // toUser wild card * is to all users 00585 void RemoteWebUsers::sendSystemMessage( 00586 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* supervisorDescriptor, 00587 const std::string& toUser, 00588 const std::string& msg) 00589 { 00590 SOAPParameters parameters; 00591 parameters.addParameter("ToUser", toUser); 00592 parameters.addParameter("Message", msg); 00593 00594 xoap::MessageReference retMsg = SOAPMessenger::sendWithSOAPReply( 00595 supervisorDescriptor, "SupervisorSystemMessage", parameters); 00596 } 00597 00598 //======================================================================================================================== 00599 // makeSystemLogbookEntry 00600 // make system logbook through Supervisor 00601 void RemoteWebUsers::makeSystemLogbookEntry( 00602 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* supervisorDescriptor, 00603 const std::string& entryText) 00604 { 00605 SOAPParameters parameters; 00606 parameters.addParameter("EntryText", entryText); 00607 00608 xoap::MessageReference retMsg = SOAPMessenger::sendWithSOAPReply( 00609 supervisorDescriptor, "SupervisorSystemLogbookEntry", parameters); 00610 }