public function process() { parent::process(); if (!$this->getRequest()->isMutation()) { return; } $rules = is_array($this->parameters['Rules']) ? $this->parameters['Rules'] : array(); $A = $this->getAdapter(); foreach ($rules as $key => $values) { if (!isset($A[$key])) { throw new \RuntimeException("Unexistent fwrule key: {$key}", 1402062247); } $hasPosition = isset($rules[$key]['Position']) && $rules[$key]['Position'] > 0; if (!$hasPosition) { continue; } if (!isset($A[$key]['Position']) || $A[$key]['Position'] != $rules[$key]['Position']) { // array assignment merges with existing props: $A[$key] = array('Position' => $rules[$key]['Position']); } } if ($A->isModified()) { $A->save(); $this->getParent()->fixOrderedSetPositions(); } if (!$this->getRequest()->hasParameter('sortonly')) { $this->getPlatform()->signalEvent('firewall-adjust &'); } }
public function process() { parent::process(); if ($this->getRequest()->isMutation()) { $this->getPlatform()->getDatabase('SESSION')->setKey(get_class($this->getParent()), 'array', array('groups' => $this->parameters['groups'])); } }
public function process() { parent::process(); if (!$this->getRequest()->isMutation()) { return; } $args = array(); $txOrder = $this->getTransactionOrder(); if (!empty($txOrder['addGroups'])) { $args[] = '--install'; $args[] = implode(',', array_map(function ($i) { return '@' . $i; }, $txOrder['addGroups'])); } if (!empty($txOrder['removeGroups'])) { $args[] = '--remove'; $args[] = implode(',', array_map(function ($i) { return '@' . $i; }, $txOrder['removeGroups'])); } if (!empty($txOrder['addPackages'])) { $args[] = '--install'; $args[] = implode(',', $txOrder['addPackages']); } if (!empty($txOrder['removePackages'])) { $args[] = '--remove'; $args[] = implode(',', $txOrder['removePackages']); } if (count($args) > 0) { $this->getPlatform()->exec('/usr/bin/sudo /usr/libexec/nethserver/pkgaction ${@}', $args, TRUE); } }
public function process() { parent::process(); if ($this->getRequest()->isMutation()) { $this->getPlatform()->getDatabase('fwservices')->setKey($this->parameters['name'], 'fwservice', array('Description' => $this->parameters['Description'], 'Protocol' => $this->parameters['Protocol'], 'Ports' => $this->parameters['Ports'])); $this->state->resume($this->getParent()->getSession())->assign(sprintf("fwservice;%s", $this->parameters['name'])); } }
public function process() { parent::process(); if ($this->getRequest()->isMutation()) { $this->getAdapter()->offsetUnset($this->parameters['ruleId']); $this->getAdapter()->save(); } }
public function process() { parent::process(); if ($this->getRequest()->isMutation()) { $this->getPlatform()->getDatabase('hosts')->setKey($this->parameters['name'], 'host-group', array('Description' => $this->parameters['Description'], 'Members' => implode(',', is_array($this->parameters['Members']) ? $this->parameters['Members'] : array()))); $this->state->resume($this->getParent()->getSession())->assign(sprintf("host-group;%s", $this->parameters['name'])); } }
public function process() { parent::process(); if ($this->getRequest()->isMutation()) { $this->getPlatform()->getDatabase('networks')->setKey($this->parameters['name'], 'zone', array('Description' => $this->parameters['Description'], 'Interface' => $this->parameters['Interface'], 'Network' => $this->parameters['Network'])); $this->state->resume($this->getParent()->getSession())->assign(sprintf("zone;%s", $this->parameters['name'])); } }
public function process() { parent::process(); if ($this->getRequest()->isMutation()) { $this->getPlatform()->getDatabase('hosts')->setKey($this->parameters['name'], 'iprange', array('Description' => $this->parameters['Description'], 'Start' => $this->parameters['Start'], 'End' => $this->parameters['End'])); $this->state->resume($this->getParent()->getSession())->assign(sprintf("iprange;%s", $this->parameters['name'])); } }