Commit 8a571cb3 authored by Côme Chilliet's avatar Côme Chilliet Committed by bmortier

Fixes #5509 Catching LDAP exceptions in dashboard tabs

parent d82f655a
......@@ -70,7 +70,11 @@ class dashboard extends simplePlugin
$nb = objects::count($type);
} catch (FusionDirectoryException $e) {
$nb = 0;
trigger_error("Problem with $type:".$e->getMessage());
msg_dialog::display(
_('LDAP error'),
sprintf(_('Statistics for type "%s" could not be computed because of the following error: %s'), $type, $e->getMessage()),
ERROR_DIALOG
);
}
if ($nb == 0) {
continue;
......
......@@ -55,7 +55,16 @@ class dashboardPassword extends simplePlugin
$defaultMethod = $config->get_cfg_value('passwordDefaultHash', 'ssha');
$forceDefault = ($config->get_cfg_value('forcePasswordDefaultHash', 'FALSE') == 'TRUE');
$users = objects::ls('user', 'userPassword');
try {
$users = objects::ls('user', 'userPassword');
} catch (LDAPFailureException $e) {
msg_dialog::display(
_('LDAP error'),
sprintf(_('Password statistics could not be computed because of the following LDAP error: %s'), $e->getMessage()),
ERROR_DIALOG
);
$users = array();
}
$nb_accounts = count($users);
$nb_locked_accounts = 0;
$methods_stats = array();
......
......@@ -66,7 +66,16 @@ class dashboardUsers extends simplePlugin
{
global $config;
/* User statistics */
$nb_accounts = objects::count('user');
try {
$nb_accounts = objects::count('user');
} catch (LDAPFailureException $e) {
msg_dialog::display(
_('LDAP error'),
sprintf(_('Total user number could not be computed because of the following LDAP error: %s'), $e->getMessage()),
ERROR_DIALOG
);
$nb_accounts = 0;
}
$ldap = $config->get_ldap_link();
$ldap->cd($config->current['BASE']);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment