Example #1
0
 public function validateRequestParams()
 {
     $loggedIn = Session::getData(REQUEST_PARAMETER_LOGGEDIN);
     $this->user = Session::getData(REQUEST_PARAMETER_USER_NAME);
     if (!$loggedIn || !isset($this->user['UserName']) || !isset($this->user['Email'])) {
         ErrorHandler::error(E_ERROR, 'This action is not allowed');
     }
     $this->visualizationId = $this->getParam(REQUEST_PARAMETER_VIZ_ID);
     if (!$this->visualizationId) {
         ErrorHandler::error(E_ERROR, 'An invalid visualization was requested');
     }
     $visualization = $this->getVisualization();
     if (!isset($visualization[REQUEST_PARAMETER_VIZ_ID]) || $this->visualizationId === $visualization[REQUEST_PARAMETER_VIZ_ID]) {
         Session::clearData(REQUEST_PARAMETER_VIZ);
     }
 }
Example #2
0
 /**
  * Validate a request.
  *
  * @return      boolean                         True on success
  */
 public function validateRequest()
 {
     // In case of a missing request, throw an exception
     if (empty($this->request)) {
         ErrorHandler::error(E_ERROR, 'No request object was found for validation');
     }
     // Validate the endpoint
     $service = $this->validateEndpoint();
     // In case of an invalid endpoint, throw an exception
     if (!$service) {
         ErrorHandler::error(E_ERROR, 'Invalid endpoint specified');
     }
     $this->setLocale(REQUEST_LOCALE_DEFAULT);
     if (Session::getData(REQUEST_PARAMETER_LOGGEDIN)) {
         $user = Session::getData(REQUEST_PARAMETER_USER_NAME);
         if (!isset($user['UserName'])) {
             $this->clearSession();
         }
         $this->setParam('freshLogin', (bool) Session::getData('freshLogin'));
         Session::clearData('freshLogin');
     }
     // Return the validation result
     return true;
 }
Example #3
0
 /**
  * Clear the current session.
  */
 public function clearSession()
 {
     Session::clearData(REQUEST_PARAMETER_LOGGEDIN);
     Session::clearData(REQUEST_PARAMETER_USER_NAME);
 }