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:
parent
d95874b84c
commit
3dddee8b7d
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue