sessionCallback = $sessionCallback; } public function enable() { $this->enabled = true; } /** * @return ISession */ private function getSession() { $callback = $this->sessionCallback; return $callback(); } private function getScopeAsArray() { if (!$this->scope) { $session = $this->getSession(); $sessionScope = $session->get('token_scope'); if ($sessionScope) { $this->scope = $sessionScope; } } return $this->scope; } public function setToken(IToken $token) { $this->scope = $token->getScopeAsArray(); $session = $this->getSession(); $session->set('token_scope', $this->scope); $this->enable(); } public function canAccessFilesystem() { $scope = $this->getScopeAsArray(); return !$scope || $scope[IToken::SCOPE_FILESYSTEM]; } }