Setup: Fix authentication backend validation

This is a ridiculous dirty fix. We'll definitely need to
improve how we create authentication backends...

fixes #9509
This commit is contained in:
Johannes Meyer 2015-06-25 14:36:51 +02:00
parent d95874b84c
commit 3dddee8b7d
3 changed files with 15 additions and 14 deletions

View File

@ -202,16 +202,4 @@ class LdapBackendForm extends Form
return true;
}
/**
* Return the configuration for the chosen resource
*
* @return ConfigObject
*
* @todo Check whether it's possible to drop this (Or even all occurences!)
*/
public function getResourceConfig()
{
return ResourceFactory::getResourceConfig($this->getValue('resource'));
}
}

View File

@ -163,7 +163,12 @@ class UserBackend
$name
);
}
$resource = ResourceFactory::create($backendConfig->resource);
if ($backendConfig->resource instanceof ConfigObject) {
$resource = ResourceFactory::createResource($backendConfig->resource);
} else {
$resource = ResourceFactory::create($backendConfig->resource);
}
switch ($backendType) {
case 'db':

View File

@ -122,7 +122,15 @@ class AuthBackendPage extends Form
}
if (false === isset($data['skip_validation']) || $data['skip_validation'] == 0) {
if ($this->config['type'] === 'ldap' && false === LdapBackendForm::isValidUserBackend($this)) {
$self = clone $this;
$self->addElement(
'text',
'resource',
array(
'value' => $this->getResourceConfig()
)
);
if ($this->config['type'] === 'ldap' && false === LdapBackendForm::isValidUserBackend($self)) {
$this->addSkipValidationCheckbox();
return false;
}