Example #1
0
 public function getReport()
 {
     if ($this->error === false) {
         return array(sprintf(mt('setup', 'General configuration has been successfully written to: %s'), Config::resolvePath('config.ini')));
     } elseif ($this->error !== null) {
         return array(sprintf(mt('setup', 'General configuration could not be written to: %s. An error occured:'), Config::resolvePath('config.ini')), sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->error)));
     }
 }
Example #2
0
 public function getReport()
 {
     if ($this->error === false) {
         return array(sprintf(mt('monitoring', 'Monitoring instance configuration has been successfully created: %s'), Config::resolvePath('modules/monitoring/instances.ini')));
     } elseif ($this->error !== null) {
         return array(sprintf(mt('monitoring', 'Monitoring instance configuration could not be written to: %s. An error occured:'), Config::resolvePath('modules/monitoring/instances.ini')), sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage()));
     }
 }
Example #3
0
 public function getReport()
 {
     if ($this->error === false) {
         return array(sprintf(mt('monitoring', 'Command transport configuration has been successfully created: %s'), Config::resolvePath('modules/monitoring/commandtransports.ini')));
     } elseif ($this->error !== null) {
         return array(sprintf(mt('monitoring', 'Command transport configuration could not be written to: %s. An error occured:'), Config::resolvePath('modules/monitoring/commandtransports.ini')), sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->error)));
     }
 }
Example #4
0
 public function getReport()
 {
     if ($this->error === false) {
         $message = mt('monitoring', 'Monitoring instance configuration has been successfully created: %s');
         return '<p>' . sprintf($message, Config::resolvePath('modules/monitoring/instances.ini')) . '</p>';
     } elseif ($this->error !== null) {
         $message = mt('monitoring', 'Monitoring instance configuration could not be written to: %s; An error occured:');
         return '<p class="error">' . sprintf($message, Config::resolvePath('modules/monitoring/instances.ini')) . '</p><p>' . $this->error->getMessage() . '</p>';
     }
 }
Example #5
0
 public function getReport()
 {
     if ($this->error === false) {
         $message = mt('setup', 'General configuration has been successfully written to: %s');
         return '<p>' . sprintf($message, Config::resolvePath('config.ini')) . '</p>';
     } elseif ($this->error !== null) {
         $message = mt('setup', 'General configuration could not be written to: %s; An error occured:');
         return '<p class="error">' . sprintf($message, Config::resolvePath('config.ini')) . '</p>' . '<p>' . $this->error->getMessage() . '</p>';
     }
 }
Example #6
0
 public function getReport()
 {
     $report = array();
     if ($this->backendIniError === false) {
         $report[] = sprintf(mt('monitoring', 'Monitoring backend configuration has been successfully written to: %s'), Config::resolvePath('modules/monitoring/backends.ini'));
     } elseif ($this->backendIniError !== null) {
         $report[] = sprintf(mt('monitoring', 'Monitoring backend configuration could not be written to: %s. An error occured:'), Config::resolvePath('modules/monitoring/backends.ini'));
         $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->backendIniError->getMessage());
     }
     if ($this->resourcesIniError === false) {
         $report[] = sprintf(mt('monitoring', 'Resource configuration has been successfully updated: %s'), Config::resolvePath('resources.ini'));
     } elseif ($this->resourcesIniError !== null) {
         $report[] = sprintf(mt('monitoring', 'Resource configuration could not be udpated: %s. An error occured:'), Config::resolvePath('resources.ini'));
         $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->resourcesIniError->getMessage());
     }
     return $report;
 }
Example #7
0
 public function getReport()
 {
     $report = '';
     if ($this->backendIniError === false) {
         $message = mt('monitoring', 'Monitoring backend configuration has been successfully written to: %s');
         $report .= '<p>' . sprintf($message, Config::resolvePath('modules/monitoring/backends.ini')) . '</p>';
     } elseif ($this->backendIniError !== null) {
         $message = mt('monitoring', 'Monitoring backend configuration could not be written to: %s; An error occured:');
         $report .= '<p class="error">' . sprintf($message, Config::resolvePath('modules/monitoring/backends.ini')) . '</p><p>' . $this->backendIniError->getMessage() . '</p>';
     }
     if ($this->resourcesIniError === false) {
         $message = mt('monitoring', 'Resource configuration has been successfully updated: %s');
         $report .= '<p>' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>';
     } elseif ($this->resourcesIniError !== null) {
         $message = mt('monitoring', 'Resource configuration could not be udpated: %s; An error occured:');
         $report .= '<p class="error">' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>' . '<p>' . $this->resourcesIniError->getMessage() . '</p>';
     }
     return $report;
 }
Example #8
0
 /**
  * Get config file
  *
  * @return string
  */
 public function getConfigFile()
 {
     if ($this->user === null) {
         throw new ProgrammingError('Can\'t load dashboards. User is not set');
     }
     return Config::resolvePath('dashboards/' . $this->user->getUsername() . '/dashboard.ini');
 }
Example #9
0
 public function getReport()
 {
     $report = '';
     if ($this->authIniError === false) {
         $message = mt('setup', 'Authentication configuration has been successfully written to: %s');
         $report .= '<p>' . sprintf($message, Config::resolvePath('authentication.ini')) . '</p>';
     } elseif ($this->authIniError !== null) {
         $message = mt('setup', 'Authentication configuration could not be written to: %s; An error occured:');
         $report .= '<p class="error">' . sprintf($message, Config::resolvePath('authentication.ini')) . '</p>' . '<p>' . $this->authIniError->getMessage() . '</p>';
     }
     if ($this->dbError === false) {
         $message = mt('setup', 'Account "%s" has been successfully created.');
         $report .= '<p>' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>';
     } elseif ($this->dbError !== null) {
         $message = mt('setup', 'Unable to create account "%s". An error occured:');
         $report .= '<p class="error">' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>' . '<p>' . $this->dbError->getMessage() . '</p>';
     }
     if ($this->permIniError === false) {
         $message = mt('setup', 'Account "%s" has been successfully defined as initial administrator.');
         $report .= '<p>' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>';
     } elseif ($this->permIniError !== null) {
         $message = mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:');
         $report .= '<p class="error">' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>' . '<p>' . $this->permIniError->getMessage() . '</p>';
     }
     return $report;
 }
Example #10
0
 public function getReport()
 {
     $report = array();
     if ($this->groupIniError === false) {
         $report[] = sprintf(mt('setup', 'User Group Backend configuration has been successfully written to: %s'), Config::resolvePath('groups.ini'));
     } elseif ($this->groupIniError !== null) {
         $report[] = sprintf(mt('setup', 'User Group Backend configuration could not be written to: %s. An error occured:'), Config::resolvePath('groups.ini'));
         $report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->groupIniError));
     }
     if ($this->groupError === false) {
         $report[] = sprintf(mt('setup', 'User Group "%s" has been successfully created.'), mt('setup', 'Administrators', 'setup.role.name'));
     } elseif ($this->groupError !== null) {
         $report[] = sprintf(mt('setup', 'Unable to create user group "%s". An error occured:'), mt('setup', 'Administrators', 'setup.role.name'));
         $report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->groupError));
     }
     if ($this->memberError === false) {
         $report[] = sprintf(mt('setup', 'Account "%s" has been successfully added as member to user group "%s".'), $this->data['username'], mt('setup', 'Administrators', 'setup.role.name'));
     } elseif ($this->memberError !== null) {
         $report[] = sprintf(mt('setup', 'Unable to add account "%s" as member to user group "%s". An error occured:'), $this->data['username'], mt('setup', 'Administrators', 'setup.role.name'));
         $report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->memberError));
     }
     return $report;
 }
 public function getReport()
 {
     $report = array();
     if ($this->authIniError === false) {
         $report[] = sprintf(mt('setup', 'Authentication configuration has been successfully written to: %s'), Config::resolvePath('authentication.ini'));
     } elseif ($this->authIniError !== null) {
         $report[] = sprintf(mt('setup', 'Authentication configuration could not be written to: %s. An error occured:'), Config::resolvePath('authentication.ini'));
         $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->authIniError->getMessage());
     }
     if ($this->dbError === false) {
         $report[] = sprintf(mt('setup', 'Account "%s" has been successfully created.'), $this->data['adminAccountData']['username']);
     } elseif ($this->dbError !== null) {
         $report[] = sprintf(mt('setup', 'Unable to create account "%s". An error occured:'), $this->data['adminAccountData']['username']);
         $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->dbError->getMessage());
     }
     if ($this->permIniError === false) {
         $report[] = sprintf(mt('setup', 'Account "%s" has been successfully defined as initial administrator.'), $this->data['adminAccountData']['username']);
     } elseif ($this->permIniError !== null) {
         $report[] = sprintf(mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:'), $this->data['adminAccountData']['username']);
         $report[] = sprintf(mt('setup', 'ERROR: %s'), $this->permIniError->getMessage());
     }
     return $report;
 }
 /**
  * Get whether the setup token exists
  *
  * @return bool
  */
 public function setupTokenExists()
 {
     return @file_exists($this->config->resolvePath('setup.token'));
 }
Example #13
0
 /**
  * Clear the session being used by this wizard and drop the setup token
  */
 public function clearSession()
 {
     parent::clearSession();
     $tokenPath = Config::resolvePath('setup.token');
     if (file_exists($tokenPath)) {
         @unlink($tokenPath);
     }
 }
Example #14
0
 /**
  * Create preferences storage adapter from config
  *
  * @param   ConfigObject    $config     The config for the adapter
  * @param   User            $user       The user to which these preferences belong
  *
  * @return  self
  *
  * @throws  ConfigurationError          When the configuration defines an invalid storage type
  */
 public static function create(ConfigObject $config, User $user)
 {
     $type = ucfirst(strtolower($config->get('store', 'ini')));
     $storeClass = 'Icinga\\User\\Preferences\\Store\\' . $type . 'Store';
     if (!class_exists($storeClass)) {
         throw new ConfigurationError('Preferences configuration defines an invalid storage type. Storage type %s not found', $type);
     }
     if ($type === 'Ini') {
         $config->location = Config::resolvePath('preferences');
     } elseif ($type === 'Db') {
         $config->connection = new DbConnection(ResourceFactory::getResourceConfig($config->resource));
     }
     return new $storeClass($config, $user);
 }
Example #15
0
 /**
  * Load and return this user's navigation configuration
  *
  * @return  Config
  */
 public function loadNavigationConfig()
 {
     return Config::fromIni(Config::resolvePath('preferences') . DIRECTORY_SEPARATOR . $this->getUsername() . DIRECTORY_SEPARATOR . 'navigation.ini');
 }
Example #16
0
 public function getReport()
 {
     $report = array();
     if ($this->authIniError === false) {
         $report[] = sprintf(mt('setup', 'Authentication configuration has been successfully written to: %s'), Config::resolvePath('authentication.ini'));
     } elseif ($this->authIniError !== null) {
         $report[] = sprintf(mt('setup', 'Authentication configuration could not be written to: %s. An error occured:'), Config::resolvePath('authentication.ini'));
         $report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->authIniError));
     }
     if ($this->dbError === false) {
         $report[] = sprintf(mt('setup', 'Account "%s" has been successfully created.'), $this->data['adminAccountData']['username']);
     } elseif ($this->dbError !== null) {
         $report[] = sprintf(mt('setup', 'Unable to create account "%s". An error occured:'), $this->data['adminAccountData']['username']);
         $report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->dbError));
     }
     if ($this->permIniError === false) {
         $report[] = isset($this->data['adminAccountData']['username']) ? sprintf(mt('setup', 'Account "%s" has been successfully defined as initial administrator.'), $this->data['adminAccountData']['username']) : sprintf(mt('setup', 'The members of the user group "%s" were successfully defined as initial administrators.'), $this->data['adminAccountData']['groupname']);
     } elseif ($this->permIniError !== null) {
         $report[] = isset($this->data['adminAccountData']['username']) ? sprintf(mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:'), $this->data['adminAccountData']['username']) : sprintf(mt('setup', 'Unable to define the members of the user group "%s" as initial administrators. An error occured:'), $this->data['adminAccountData']['groupname']);
         $report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->permIniError));
     }
     return $report;
 }
Example #17
0
 /**
  * @depends testWhetherConfigCanBeConvertedToAnArray
  * @depends testWhetherConfigResolvePathReturnsValidAbsolutePaths
  */
 public function testWhetherItIsPossibleToInitializeAConfigFromAIniFile()
 {
     $config = Config::fromIni(Config::resolvePath('config.ini'));
     $this->assertEquals(array('logging' => array('enable' => 1), 'backend' => array('type' => 'db', 'user' => 'user', 'password' => 'password', 'disable' => 1)), $config->toArray(), 'Config::fromIni does not load INI files correctly');
     $this->assertInstanceOf(get_class($config), Config::fromIni('nichda'), 'Config::fromIni does not return empty configs for non-existent configuration files');
 }