mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 07:14:35 +02:00
parent
ff5142896b
commit
c5761243c1
@ -62,14 +62,24 @@ class AuthenticationStep extends Step
|
|||||||
|
|
||||||
protected function createRolesIni()
|
protected function createRolesIni()
|
||||||
{
|
{
|
||||||
$config = array();
|
if (isset($this->data['adminAccountData']['username'])) {
|
||||||
$config['admins'] = array(
|
$config = array(
|
||||||
'users' => $this->data['adminAccountData']['username'],
|
'users' => $this->data['adminAccountData']['username'],
|
||||||
'permissions' => '*'
|
'permissions' => '*'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->data['backendConfig']['backend'] === 'db') {
|
||||||
|
$config['groups'] = mt('setup', 'Administrators', 'setup.role.name');
|
||||||
|
}
|
||||||
|
} else { // isset($this->data['adminAccountData']['groupname'])
|
||||||
|
$config = array(
|
||||||
|
'groups' => $this->data['adminAccountData']['groupname'],
|
||||||
|
'permissions' => '*'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Config::fromArray($config)
|
Config::fromArray(array(mt('setup', 'Administrators', 'setup.role.name') => $config))
|
||||||
->setConfigFile(Config::resolvePath('roles.ini'))
|
->setConfigFile(Config::resolvePath('roles.ini'))
|
||||||
->saveIni();
|
->saveIni();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -147,13 +157,20 @@ class AuthenticationStep extends Step
|
|||||||
. '</tbody>'
|
. '</tbody>'
|
||||||
. '</table>';
|
. '</table>';
|
||||||
|
|
||||||
$adminHtml = '<p>' . (isset($this->data['adminAccountData']['resourceConfig']) ? sprintf(
|
if (isset($this->data['adminAccountData']['username'])) {
|
||||||
mt('setup', 'Administrative rights will initially be granted to a new account called "%s".'),
|
$adminHtml = '<p>' . (isset($this->data['adminAccountData']['resourceConfig']) ? sprintf(
|
||||||
$this->data['adminAccountData']['username']
|
mt('setup', 'Administrative rights will initially be granted to a new account called "%s".'),
|
||||||
) : sprintf(
|
$this->data['adminAccountData']['username']
|
||||||
mt('setup', 'Administrative rights will initially be granted to an existing account called "%s".'),
|
) : sprintf(
|
||||||
$this->data['adminAccountData']['username']
|
mt('setup', 'Administrative rights will initially be granted to an existing account called "%s".'),
|
||||||
)) . '</p>';
|
$this->data['adminAccountData']['username']
|
||||||
|
)) . '</p>';
|
||||||
|
} else { // isset($this->data['adminAccountData']['groupname'])
|
||||||
|
$adminHtml = '<p>' . sprintf(
|
||||||
|
mt('setup', 'Administrative rights will initially be granted to members of the user group "%s".'),
|
||||||
|
$this->data['adminAccountData']['groupname']
|
||||||
|
) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
return $pageTitle . '<div class="topic">' . $backendDesc . $backendTitle . $backendHtml . '</div>'
|
return $pageTitle . '<div class="topic">' . $backendDesc . $backendTitle . $backendHtml . '</div>'
|
||||||
. '<div class="topic">' . $adminTitle . $adminHtml . '</div>';
|
. '<div class="topic">' . $adminTitle . $adminHtml . '</div>';
|
||||||
@ -190,14 +207,23 @@ class AuthenticationStep extends Step
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->permIniError === false) {
|
if ($this->permIniError === false) {
|
||||||
$report[] = sprintf(
|
$report[] = isset($this->data['adminAccountData']['username']) ? sprintf(
|
||||||
mt('setup', 'Account "%s" has been successfully defined as initial administrator.'),
|
mt('setup', 'Account "%s" has been successfully defined as initial administrator.'),
|
||||||
$this->data['adminAccountData']['username']
|
$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) {
|
} elseif ($this->permIniError !== null) {
|
||||||
$report[] = sprintf(
|
$report[] = isset($this->data['adminAccountData']['username']) ? sprintf(
|
||||||
mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:'),
|
mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:'),
|
||||||
$this->data['adminAccountData']['username']
|
$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'), $this->permIniError->getMessage());
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->permIniError->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -434,14 +434,18 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$adminAccountType = $pageData['setup_admin_account']['user_type'];
|
$adminAccountType = $pageData['setup_admin_account']['user_type'];
|
||||||
$adminAccountData = array('username' => $pageData['setup_admin_account'][$adminAccountType]);
|
if ($adminAccountType === 'user_group') {
|
||||||
if ($adminAccountType === 'new_user' && !$pageData['setup_auth_db_resource']['skip_validation']
|
$adminAccountData = array('groupname' => $pageData['setup_admin_account'][$adminAccountType]);
|
||||||
&& (! isset($pageData['setup_auth_db_creation'])
|
} else {
|
||||||
|| !$pageData['setup_auth_db_creation']['skip_validation']
|
$adminAccountData = array('username' => $pageData['setup_admin_account'][$adminAccountType]);
|
||||||
)
|
if ($adminAccountType === 'new_user' && !$pageData['setup_auth_db_resource']['skip_validation']
|
||||||
) {
|
&& (! isset($pageData['setup_auth_db_creation'])
|
||||||
$adminAccountData['resourceConfig'] = $pageData['setup_auth_db_resource'];
|
|| !$pageData['setup_auth_db_creation']['skip_validation']
|
||||||
$adminAccountData['password'] = $pageData['setup_admin_account']['new_user_password'];
|
)
|
||||||
|
) {
|
||||||
|
$adminAccountData['resourceConfig'] = $pageData['setup_auth_db_resource'];
|
||||||
|
$adminAccountData['password'] = $pageData['setup_admin_account']['new_user_password'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$authType = $pageData['setup_authentication_type']['type'];
|
$authType = $pageData['setup_authentication_type']['type'];
|
||||||
$setup->addStep(
|
$setup->addStep(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user