mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
Api: Make sure the current user is always in the list of accounts sent to client
This commit is contained in:
parent
bea2659fe3
commit
00b48f3b04
@ -428,18 +428,24 @@ class Accounts
|
||||
break;
|
||||
}
|
||||
$accounts = array();
|
||||
foreach(self::getInstance()->search(array(
|
||||
'type' => $options['filter']['group'] < 0 ? $options['filter']['group'] : $type,
|
||||
'query' => $pattern,
|
||||
'query_type' => 'all',
|
||||
'order' => $order,
|
||||
'offset' => $options['num_rows']
|
||||
)) as $account)
|
||||
$params = array(
|
||||
'type' => $options['filter']['group'] < 0 ? $options['filter']['group'] : $type,
|
||||
'query' => $pattern,
|
||||
'query_type' => $options['filter']['query_type'] ?: 'all',
|
||||
'order' => $order,
|
||||
'offset' => $options['num_rows']
|
||||
);
|
||||
if(array_key_exists('account_id', $options))
|
||||
{
|
||||
$params['account_id'] = $options['account_id'];
|
||||
}
|
||||
foreach(self::getInstance()->search($params) as $account)
|
||||
{
|
||||
$displayName = self::format_username($account['account_lid'],
|
||||
$account['account_firstname'],$account['account_lastname'],$account['account_id']);
|
||||
$account['account_firstname'], $account['account_lastname'], $account['account_id']
|
||||
);
|
||||
|
||||
if (!empty($options['tag_list']))
|
||||
if(!empty($options['tag_list']))
|
||||
{
|
||||
$result = [
|
||||
'value' => $account['account_id'],
|
||||
|
@ -1678,7 +1678,15 @@ abstract class Framework extends Framework\Extra
|
||||
foreach($list as $type => &$accounts)
|
||||
{
|
||||
$options = array('account_type' => $type, 'tag_list' => true) + $accounts;
|
||||
$accounts = Accounts::link_query('',$options);
|
||||
$accounts = Accounts::link_query('', $options);
|
||||
}
|
||||
unset($list["accounts"][9]);
|
||||
// Make sure the user themselves is in there
|
||||
if(!array_key_exists($GLOBALS['egw_info']['user']['account_id'], $list['accounts']))
|
||||
{
|
||||
$options = array('account_type' => 'accounts', 'tag_list' => true,
|
||||
'account_id' => $GLOBALS['egw_info']['user']['account_id']) + $list['accounts'];
|
||||
$list['accounts'] += Accounts::link_query('', $options);
|
||||
}
|
||||
|
||||
Json\Response::get()->data($list);
|
||||
|
Loading…
Reference in New Issue
Block a user