From bff3b0215e11aa83a4b10c934c316b37897b8395 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 29 Jan 2018 12:47:57 +0100 Subject: [PATCH] * LDAP/ActiveDirectory: fix sorting accounts by anything other then account-name fails --- api/src/Accounts/Ads.php | 4 ++++ api/src/Accounts/Ldap.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/api/src/Accounts/Ads.php b/api/src/Accounts/Ads.php index e36c6f950f..cedd3fc2c7 100644 --- a/api/src/Accounts/Ads.php +++ b/api/src/Accounts/Ads.php @@ -943,6 +943,10 @@ class Ads // sort the array $this->_callback_sort = strtoupper($param['sort']); $this->_callback_order = empty($param['order']) ? array('account_lid') : explode(',',$param['order']); + foreach($this->_callback_order as &$col) + { + if (substr($col, 0, 8) !== 'account_') $col = 'account_'.$col; + } $sortedAccounts = $accounts; uasort($sortedAccounts,array($this,'_sort_callback')); $account_search[$unl_serial]['data'] = $sortedAccounts; diff --git a/api/src/Accounts/Ldap.php b/api/src/Accounts/Ldap.php index e80c672408..3d18867707 100644 --- a/api/src/Accounts/Ldap.php +++ b/api/src/Accounts/Ldap.php @@ -853,6 +853,10 @@ class Ldap // sort the array $this->_callback_sort = strtoupper($param['sort']); $this->_callback_order = empty($param['order']) ? array('account_lid') : explode(',',$param['order']); + foreach($this->_callback_order as &$col) + { + if (substr($col, 0, 8) !== 'account_') $col = 'account_'.$col; + } $sortedAccounts = $accounts; uasort($sortedAccounts,array($this,'_sort_callback')); $this->total = isset($totalcount) ? $totalcount : count($accounts);