mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-16 18:31:26 +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,16 +428,22 @@ class Accounts
|
||||
break;
|
||||
}
|
||||
$accounts = array();
|
||||
foreach(self::getInstance()->search(array(
|
||||
$params = array(
|
||||
'type' => $options['filter']['group'] < 0 ? $options['filter']['group'] : $type,
|
||||
'query' => $pattern,
|
||||
'query_type' => 'all',
|
||||
'query_type' => $options['filter']['query_type'] ?: 'all',
|
||||
'order' => $order,
|
||||
'offset' => $options['num_rows']
|
||||
)) as $account)
|
||||
);
|
||||
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']))
|
||||
{
|
||||
|
@ -1680,6 +1680,14 @@ abstract class Framework extends Framework\Extra
|
||||
$options = array('account_type' => $type, 'tag_list' => true) + $accounts;
|
||||
$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);
|
||||
return $list;
|
||||
|
Loading…
Reference in New Issue
Block a user