Skip to content

Commit

Permalink
Fix that it is not possible to create an autologin auth backend
Browse files Browse the repository at this point in the history
Occured only when no database resource nor a ldap resource exists.
  • Loading branch information
Johannes Meyer committed Oct 15, 2014
1 parent 00ffb34 commit 1daeaef
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions application/forms/Config/AuthenticationBackendConfigForm.php
Expand Up @@ -40,8 +40,6 @@ public function init()
* @param Config $resources The resource configuration
*
* @return self
*
* @throws ConfigurationError In case no resources are available for authentication
*/
public function setResourceConfig(Config $resourceConfig)
{
Expand All @@ -50,10 +48,6 @@ public function setResourceConfig(Config $resourceConfig)
$resources[strtolower($resource->type)][] = $name;
}

if (empty($resources)) {
throw new ConfigurationError(t('Could not find any resources for authentication'));
}

$this->resources = $resources;
return $this;
}
Expand Down Expand Up @@ -252,6 +246,17 @@ public function onRequest(Request $request)
$configValues['type'] = $configValues['backend'];
$configValues['name'] = $authBackend;
$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'));
}
}
}

Expand Down

0 comments on commit 1daeaef

Please sign in to comment.