public function bind(\Nethgui\Controller\RequestInterface $request) { // pass-through $request to inner action: $this->innerAction->bind($request); // pass request subset to plugins $this->plugins->bind($request->spawnRequest($this->plugins->getIdentifier())); }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); if (!$this->getRequest()->isMutation()) { $this->messageCount = count($this->getAdapter()); } }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); $currentUser = $this->getRequest()->getUser()->getCredential('username'); if (isset($this->userName)) { $userExists = strlen($this->userName) > 0 && ($this->userName === 'root' || $this->getPlatform()->getDatabase('NethServer::Database::Passwd')->getType($this->userName) === 'passwd'); if (!$userExists) { throw new \Nethgui\Exception\HttpException('Not found' . $this->userName, 404, 1322148399); } // The resource the current user is acting on is another user or // the current user oneself. The policy decision point is delegated // to decide whether the current user has enough rights to change // the other user's password. Refs #1580 $resource = $currentUser === $this->userName ? 'Oneself' : 'SomeoneElse'; } else { $this->userName = $currentUser; $resource = 'Oneself'; } $response = $this->getPolicyDecisionPoint()->authorize($this->getRequest()->getUser(), $resource, self::ACTION_CHANGE_PASSWORD); if ($response->isDenied()) { throw $response->asException(1354619038); } elseif ($request->isMutation()) { $this->getLog()->notice(sprintf("%s: %s is changing password to %s (%s). %s", __CLASS__, $currentUser, $resource, $this->userName, $response->getMessage())); $this->stash->store($this->parameters['newPassword']); } }
public function bind(\Nethgui\Controller\RequestInterface $request) { if (!$request->isMutation() && $this->getPlatform()->getDatabase('SESSION')->getKey($this->sessionKey)) { // Clear the session key when starting a new wizard $this->getPlatform()->getDatabase('SESSION')->deleteKey($this->sessionKey); } parent::bind($request); }
public function bind(\Nethgui\Controller\RequestInterface $request) { $this->declareParameter('service', Validate::ANYTHING); parent::bind($request); $service = \Nethgui\array_end($request->getPath()); if (!$service) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1454344500); } $this->parameters['service'] = $service; }
public function bind(\Nethgui\Controller\RequestInterface $request) { $this->declareParameter('username', Validate::USERNAME); parent::bind($request); $username = \Nethgui\array_end($request->getPath()); if (!$username) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1322148400); } $this->parameters['username'] = $username; }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); $this->key = \Nethgui\array_end($request->getPath()); /* @var $tableAdapter \ArrayInterface */ $tableAdapter = $this->getAdapter(); // Check if the ibay identifier is set: if (!isset($tableAdapter[$this->key])) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1353949626); } }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); if ($this->getIdentifier() !== 'create') { $this->parameters['Name'] = \Nethgui\array_end($request->getPath()); } if ($this->getRequest()->isMutation()) { $this->parameters['NewName'] = $this->getRequest()->getParameter('Name'); $this->parameters['pseudonym'] = trim($this->getRequest()->getParameter('localAddress')) . '@' . $this->getRequest()->getParameter('domainAddress'); } }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); $defaults = $this->getCertDefaults(); foreach ($request->getParameterNames() as $p) { if (!isset($defaults[$p . '_default'])) { continue; } if (!$this->parameters[$p]) { $this->parameters[$p] = $defaults[$p . '_default']; } } }
public function bind(\Nethgui\Controller\RequestInterface $request) { $keyValue = \Nethgui\array_head($request->getPath()); $adapter = $this->getParent()->getAdapter(); if (!isset($adapter[$keyValue])) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1399456905); } if (!in_array($adapter[$keyValue]['type'], array('bridge', 'bond', 'alias', 'vlan', 'xdsl'))) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1399456906); } parent::bind($request); $this->parameters['type'] = $adapter[$keyValue]['type']; $this->parameters['device'] = $keyValue; }
public function bind(\Nethgui\Controller\RequestInterface $request) { $keyValue = \Nethgui\array_head($request->getPath()); $adapter = $this->getParent()->getAdapter(); if (!isset($adapter[$keyValue])) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1399456808); } $props = $adapter[$keyValue]; if ($props['type'] !== 'ethernet') { throw new \Nethgui\Exception\HttpException('Not found', 404, 1399456809); } parent::bind($request); $this->parameters['device'] = $keyValue; }
public function bind(\Nethgui\Controller\RequestInterface $request) { if (!$this->hasAdapter()) { throw new \LogicException(sprintf('%s: in %s you must invoke setAdapter() before bind().', __CLASS__, get_class($this)), 1325673694); } if (is_null($this->getKey())) { throw new \LogicException(sprintf('%s: unknown key field name.', get_class($this)), 1325673717); } foreach ($this->getSchema() as $parameterDeclaration) { $parameterName = array_shift($parameterDeclaration); $validator = array_shift($parameterDeclaration); $valueProvider = array_shift($parameterDeclaration); if ($valueProvider === self::KEY) { $valueProvider = new \Nethgui\Adapter\RecordKeyAdapter($this->getAdapter()); } elseif ($valueProvider === self::FIELD) { $prop = array_shift($parameterDeclaration); $separator = array_shift($parameterDeclaration); // Null prop name falls back into parameterName: if (is_null($prop)) { $prop = $parameterName; } $valueProvider = array($this->getAdapter(), $prop, NULL, $separator); } $this->declareParameter($parameterName, $validator, $valueProvider); } parent::bind($request); if (!$request->isMutation() && !$this->getAdapter()->getKeyValue()) { // initialize default parameter values foreach ($this->defaultValues as $paramName => $paramValue) { $this->parameters[$paramName] = $paramValue; } } }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); if ($request->isMutation()) { $this->parameters['PppoeUser'] = trim($request->getParameter('PppoeUser')); $this->parameters['PppoeProvider'] = trim($request->getParameter('PppoeProvider')); $this->parameters['PppoePassword'] = trim($request->getParameter('PppoePassword')); } }