mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 06:14:25 +02:00
Fix that it is not possible to create an autologin auth backend
Occured only when no database resource nor a ldap resource exists.
This commit is contained in:
parent
00ffb34829
commit
1daeaef1c5
@ -40,8 +40,6 @@ class AuthenticationBackendConfigForm extends ConfigForm
|
|||||||
* @param Config $resources The resource configuration
|
* @param Config $resources The resource configuration
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*
|
|
||||||
* @throws ConfigurationError In case no resources are available for authentication
|
|
||||||
*/
|
*/
|
||||||
public function setResourceConfig(Config $resourceConfig)
|
public function setResourceConfig(Config $resourceConfig)
|
||||||
{
|
{
|
||||||
@ -50,10 +48,6 @@ class AuthenticationBackendConfigForm extends ConfigForm
|
|||||||
$resources[strtolower($resource->type)][] = $name;
|
$resources[strtolower($resource->type)][] = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($resources)) {
|
|
||||||
throw new ConfigurationError(t('Could not find any resources for authentication'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->resources = $resources;
|
$this->resources = $resources;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -252,6 +246,17 @@ class AuthenticationBackendConfigForm extends ConfigForm
|
|||||||
$configValues['type'] = $configValues['backend'];
|
$configValues['type'] = $configValues['backend'];
|
||||||
$configValues['name'] = $authBackend;
|
$configValues['name'] = $authBackend;
|
||||||
$this->populate($configValues);
|
$this->populate($configValues);
|
||||||
|
} elseif (empty($this->resources)) {
|
||||||
|
$autologinBackends = array_filter(
|
||||||
|
$this->config->toArray(),
|
||||||
|
function ($authBackendCfg) {
|
||||||
|
return isset($authBackendCfg['backend']) && $authBackendCfg['backend'] === 'autologin';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (false === empty($autologinBackends)) {
|
||||||
|
throw new ConfigurationError(t('Could not find any resources for authentication'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user