system: better authserver parsing for #2578

This commit is contained in:
Franco Fichtner 2018-07-26 14:53:47 +00:00
parent d4190f08d6
commit 8e28b78c65
2 changed files with 21 additions and 6 deletions

View File

@ -1047,16 +1047,25 @@ $( document ).ready(function() {
</td>
<td class="text-nowrap">
<?php
$authcfg_type = auth_get_authserver($config['system']['webgui']['authmode'])['type'];
if ($authcfg_type == 'ldap') :?>
$can_import = false;
if (!empty($config['system']['webgui']['authmode'])) {
$servers = explode(',', $config['system']['webgui']['authmode']);
foreach ($servers as $server) {
$authcfg_type = auth_get_authserver($server)['type'];
if ($authcfg_type == 'ldap') {
$can_import = true;
}
}
}
?>
<?php if ($can_import): ?>
<button type="submit" name="import"
id="import_ldap_users"
class="btn btn-default btn-xs"
title="<?=gettext("import users")?>">
<i class="fa fa-cloud-download fa-fw"></i>
</button>
<?php
endif;?>
<?php endif ?>
</td>
</tr>
</tbody>

View File

@ -63,8 +63,14 @@ $ldap_users= array();
$ldap_is_connected = false;
$exit_form = false;
// find gui auth server
$authcfg = auth_get_authserver($config['system']['webgui']['authmode']);
// XXX find first LDAP GUI auth server, better select later on
$servers = explode(',', $config['system']['webgui']['authmode']);
foreach ($servers as $server) {
$authcfg = auth_get_authserver($server);
if ($authcfg['type'] == 'ldap') {
break;
}
}
if ($authcfg['type'] == 'ldap') {
// setup peer ca