/** * * @param \Nethgui\Utility\SessionInterface $session * @return \NethServer\Module\FirewallRules\RuleWorkflow * @throws \RuntimeException */ public function resume(\Nethgui\Utility\SessionInterface $session) { $this->state = $session->retrieve(self::SESSION_KEY); if (!$this->state instanceof \ArrayObject) { throw new \RuntimeException("NULL workflow state", 1401978436); } return $this; }
public function process() { $request = $this->getRequest(); if ($request->isMutation() && $this->parameters['action'] === 'logout') { $this->getLog()->notice(sprintf("%s: user %s logged out", __CLASS__, $request->getUser()->getCredential('username'))); $this->session->logout(); } }
private function retrieveFromSession() { $state = $this->session->retrieve(__CLASS__); if ($state instanceof \ArrayObject) { $this->state = $state; } else { // TODO: try to resume the session stored in old format: $u = $this->session->retrieve(\Nethgui\Authorization\UserInterface::ID); if ($u instanceof self) { $this->state = $u->state; $this->session->store(__CLASS__, $this->state); } else { $this->session->login()->store(__CLASS__, $this->state); } } $this->modified = FALSE; }
public function setSession(\Nethgui\Utility\SessionInterface $session) { /* @var $data \ArrayObject */ $data = $session->retrieve(__CLASS__); if ($data !== NULL) { /* @var $data \ArrayObject */ $this->data->exchangeArray(array_replace_recursive($data->getArrayCopy(), $this->data->getArrayCopy())); } $session->store(__CLASS__, $this->data); return $this; }