示例#1
0
 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();
     }
 }
示例#2
0
 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);
 }