public function wsAuthenticate($action, $httpVars, $fileVars) { $this->logDebug("Entering wsAuthenticate"); $configs = $this->getConfigs(); if (!isset($httpVars["key"]) || $httpVars["key"] != $configs["WS_SERVER_ADMIN"]) { throw new Exception("Cannot authentify admin key"); } $user = AuthService::getLoggedUser(); if ($user == null) { $this->logDebug("Error Authenticating through WebSocket (not logged)"); throw new Exception("You must be logged in"); } $xml = AJXP_XMLWriter::getUserXML($user); // add groupPath if ($user->getGroupPath() != null) { $groupString = "groupPath=\"" . AJXP_Utils::xmlEntities($user->getGroupPath()) . "\""; $xml = str_replace("<user id=", "<user {$groupString} id=", $xml); } $this->logDebug("Authenticating user " . $user->id . " through WebSocket"); AJXP_XMLWriter::header(); echo $xml; AJXP_XMLWriter::close(); }
function sendUserData($userObject = null, $details = false) { print AJXP_XMLWriter::getUserXML($userObject, $details); }