* ActiveDirectory: fix "not a valid GUID" error, when getting an avatar of a group

This commit is contained in:
Ralf Becker 2019-03-09 12:38:15 +01:00
parent 54df2bcb6b
commit bf51083891
2 changed files with 20 additions and 10 deletions

View File

@ -177,7 +177,10 @@ class Ads extends Ldap
!is_array($_contact_id) && substr($_contact_id,0,8) == 'account:') !is_array($_contact_id) && substr($_contact_id,0,8) == 'account:')
{ {
$account_id = (int)(is_array($_contact_id) ? $_contact_id['account_id'] : substr($_contact_id,8)); $account_id = (int)(is_array($_contact_id) ? $_contact_id['account_id'] : substr($_contact_id,8));
$_contact_id = $GLOBALS['egw']->accounts->id2name($account_id, 'person_id'); if ($account_id < 0 || !($_contact_id = $GLOBALS['egw']->accounts->id2name($account_id, 'person_id')))
{
return false;
}
} }
$contact_id = !is_array($_contact_id) ? $_contact_id : $contact_id = !is_array($_contact_id) ? $_contact_id :
(isset ($_contact_id['id']) ? $_contact_id['id'] : $_contact_id['uid']); (isset ($_contact_id['id']) ? $_contact_id['id'] : $_contact_id['uid']);

View File

@ -63,18 +63,25 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
$accounts += $accounts_type; $accounts += $accounts_type;
} }
$sel_options += array_map( $sel_options += array_map(
function($account_id, $account_name) { function($account_id, $account_name)
$contact_obj = new Api\Contacts(); {
$contact = $contact_obj->read('account:'.$account_id, true); $data = array(
return array(
'value' => ''.$account_id, 'value' => ''.$account_id,
'label' => $account_name, 'label' => $account_name,
'app' => lang('api-accounts'), 'app' => lang('api-accounts'),
'icon' => Api\Framework::link('/api/avatar.php', array( );
if ($account_id > 0)
{
$contact_obj = new Api\Contacts();
if (($contact = $contact_obj->read('account:'.$account_id, true)))
{
$data['icon'] = Api\Framework::link('/api/avatar.php', array(
'contact_id' => $contact['id'], 'contact_id' => $contact['id'],
'etag' => $contact['etag'] ? $contact['etag'] : 1 'etag' => $contact['etag'] ? $contact['etag'] : 1
)) ));
); }
}
return $data;
}, },
array_keys($accounts), $accounts array_keys($accounts), $accounts
); );
@ -308,7 +315,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
*/ */
public static function get_owner_label($id) public static function get_owner_label($id)
{ {
static $bo; static $bo=null;
if(!$bo) $bo = new calendar_bo(); if(!$bo) $bo = new calendar_bo();
$id = ''.$id; $id = ''.$id;