do not show classes not extending Api\Auth\Backend or interfaces as auth backends

This commit is contained in:
ralf 2023-07-02 07:34:22 +02:00
parent fa169d0e03
commit 6be2d46d1c

View File

@ -450,12 +450,14 @@ class setup_cmd_config extends setup_cmd
static $scan_done = null;
if (!$scan_done++)
{
// now add auth backends found in filesystem
// now add auth backends found in filesystem (must be sub-class of Backend, but not just an interface)
foreach(scandir(EGW_INCLUDE_ROOT.'/api/src/Auth') as $file)
{
$matches = null;
if (preg_match('/^([a-z0-9]+)\.php$/i', $file, $matches) &&
!isset($auth_types[strtolower($matches[1])]) && $matches[1] != 'Backend')
!isset($auth_types[strtolower($matches[1])]) &&
!interface_exists($class='EGroupware\\Api\\Auth\\'.$matches[1]) &&
is_subclass_of($class, Api\Auth\Backend::class))
{
$auth_types[strtolower($matches[1])] = $matches[1];
}