public function __construct() { parent::__construct(); $this->_sessionToken = RemoteSessionManager::getSessionToken(); $this->_sessionStorage = new SessionStorage(null, 'api_session'); $this->_data = new ArrayStorage(); $action = DC::getApplication()->getRoute()->getActionName(); $action = substr($action, 0, -6); if (!in_array($action, $this->_unprotectedMethods)) { $this->requireAuthorization(); } }
public function initAction() { $initData = array('session-token' => RemoteSessionManager::getSessionToken()); $securityService = SecurityService::getInstance(); if ($securityService->isAuthorized()) { $initData['isLoggedIn'] = true; $initData['user'] = $securityService->getUser(); unset($initData['user']['password']); } else { $initData['isLoggedIn'] = false; } $this->setData($initData); }