mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-23 19:31:53 +02: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;
|
break;
|
||||||
}
|
}
|
||||||
$accounts = array();
|
$accounts = array();
|
||||||
foreach(self::getInstance()->search(array(
|
$params = array(
|
||||||
'type' => $options['filter']['group'] < 0 ? $options['filter']['group'] : $type,
|
'type' => $options['filter']['group'] < 0 ? $options['filter']['group'] : $type,
|
||||||
'query' => $pattern,
|
'query' => $pattern,
|
||||||
'query_type' => 'all',
|
'query_type' => $options['filter']['query_type'] ?: 'all',
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'offset' => $options['num_rows']
|
'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'],
|
$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 = [
|
$result = [
|
||||||
'value' => $account['account_id'],
|
'value' => $account['account_id'],
|
||||||
|
@ -1678,7 +1678,15 @@ abstract class Framework extends Framework\Extra
|
|||||||
foreach($list as $type => &$accounts)
|
foreach($list as $type => &$accounts)
|
||||||
{
|
{
|
||||||
$options = array('account_type' => $type, 'tag_list' => true) + $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);
|
Json\Response::get()->data($list);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user