public static function addSettingsFormFields(QuickForm $form)
 {
     Util::addLDAPResourceFormElement($form, 'resource');
     $form->addElement('text', 'base', array('label' => 'LDAP Search Base'));
     $form->addElement('text', 'objectclass', array('label' => 'Object class'));
     $form->addElement('text', 'filter', array('label' => 'LDAP filter'));
     $form->addElement('textarea', 'query', array('label' => 'Properties', 'rows' => 5));
     return $form;
 }
 public function showAction()
 {
     $tabs = $this->getTabs();
     if ($deploymentId = $this->params->get('deployment_id')) {
         $tabs->add('deployment', array('label' => $this->translate('Deployment'), 'url' => 'director/deployment/show', 'urlParams' => array('id' => $deploymentId)));
     }
     $tabs->add('config', array('label' => $this->translate('Config'), 'url' => $this->getRequest()->getUrl()))->activate('config');
     $this->view->config = IcingaConfig::load(Util::hex2binary($this->params->get('checksum')), $this->db());
 }
 public function agentAction()
 {
     $this->getTabs()->activate('agent');
     $this->view->title = 'Agent deployment instructions';
     // TODO: Fail when no ticket
     $this->view->certname = $this->object->object_name;
     $this->view->ticket = Util::getIcingaTicket($this->view->certname, $this->api()->getTicketSalt());
     $this->view->master = 'master';
     // TODO: Change this!!
     $this->view->masterzone = 'master';
     $this->view->globalzone = 'director-global';
 }
 public function indexAction()
 {
     $this->view->title = $this->translate('Deployment details');
     $deploymentId = $this->params->get('id');
     $this->view->deployment = $deployment = DirectorDeploymentLog::load($deploymentId, $this->db());
     $this->view->config_checksum = Util::binary2hex($deployment->config_checksum);
     $this->view->config = IcingaConfig::load($deployment->config_checksum, $this->db());
     $tabs = $this->getTabs()->add('deployment', array('label' => $this->translate('Deployment'), 'url' => $this->getRequest()->getUrl()))->activate('deployment');
     if ($deployment->config_checksum !== null) {
         $tabs->add('config', array('label' => $this->translate('Config'), 'url' => 'director/config/files', 'urlParams' => array('checksum' => $this->view->config_checksum, 'deployment_id' => $deploymentId)));
     }
 }
 public function activitylogAction()
 {
     if ($id = $this->params->get('id')) {
         $this->view->entry = $this->db()->fetchActivityLogEntryById($id);
     } elseif ($checksum = $this->params->get('checksum')) {
         $this->view->entry = $this->db()->fetchActivityLogEntry(Util::hex2binary($checksum));
     }
     $this->view->neighbors = $this->db()->getActivitylogNeighbors($id, $this->params->get('type'), $this->params->get('name'));
     $entry = $this->view->entry;
     $this->activityTabs($entry);
     $this->showInfo($entry);
     $func = 'show' . ucfirst($this->params->get('show', $this->defaultTab));
     $this->{$func}($entry);
 }
 /**
  * Fügt der Datenbank-Tabelle einen entsprechenden Datensatz hinzu
  *
  * @return int  Anzahl der betroffenen Zeilen
  */
 protected function insertIntoDb()
 {
     $properties = $this->getProperties();
     if ($this->autoincKeyName !== null) {
         unset($properties[$this->autoincKeyName]);
     }
     if ($this->connection->getDbType() === 'pgsql') {
         foreach ($properties as $key => $value) {
             if (preg_match('/checksum$/', $key)) {
                 $properties[$key] = Util::pgBinEscape($value);
             }
         }
     }
     return $this->db->insert($this->table, $properties);
 }
Example #7
0
 public function getLastActivityHexChecksum()
 {
     return Util::binary2hex($this->getLastActivityChecksum());
 }
 public static function addSettingsFormFields(QuickForm $form)
 {
     Util::addDbResourceFormElement($form, 'resource');
     $form->addElement('textarea', 'query', array('label' => 'DB Query', 'required' => true, 'rows' => 15));
     return $form;
 }
Example #9
0
 /**
  * Whether the last run of this import matches the given checksum
  */
 protected function lastRowsetIs($checksum)
 {
     return $this->connection->getLatestImportedChecksum($this->source->id) === Util::binary2hex($checksum);
 }
 public static function logRemoval(DbObject $object, Db $db)
 {
     $data = array('object_name' => $object->object_name, 'action_name' => 'delete', 'author' => self::username(), 'object_type' => $object->getTableName(), 'old_properties' => json_encode($object->getOriginalProperties()), 'change_time' => date('Y-m-d H:i:s'), 'parent_checksum' => $db->getLastActivityChecksum());
     $data['checksum'] = sha1(json_encode($data), true);
     $data['parent_checksum'] = Util::hex2binary($data['parent_checksum']);
     return self::create($data)->store($db);
 }
 public static function addSettingsFormFields(QuickForm $form)
 {
     Util::addDbResourceFormElement($form, 'resource');
     $form->addElement('textarea', 'query', array('label' => 'DB Query', 'description' => 'This query should return exactly two columns, value and label', 'required' => true, 'rows' => 10));
     return $form;
 }
 public function getHexChecksum()
 {
     return Util::binary2hex($this->getChecksum());
 }