Simplify accounts exist check, by checking for total of search > 1, fixes problems with not working limited search in ldap (still returning correct total)

This commit is contained in:
Ralf Becker 2016-01-29 10:52:52 +00:00
parent 51e32dd1f4
commit 21a9d24d3a

View File

@ -1126,25 +1126,13 @@ class setup
{ {
if (!$this->setup_account_object()) return false; if (!$this->setup_account_object()) return false;
$accounts = $this->accounts->search(array( $this->accounts->search(array(
'type' => 'accounts', 'type' => 'accounts',
'start' => 0, 'start' => 0,
'offset' => 2 // we only need to check 2 accounts, if we just check for not anonymous 'offset' => 2 // we only need to check 2 accounts, if we just check for not anonymous
)); ));
if (!$accounts || !is_array($accounts) || !count($accounts)) return $this->accounts->total > 1;
{
return false;
}
foreach($accounts as $account)
{
if ($account['account_lid'] != 'anonymous')
{
// we might add further checks, eg. if the account really has admin rights here
return true;
}
}
return false;
} }
/** /**