fix LDAP/AD clients to query jpegphoto so its existence get used by the regular code to (not) generate avatar-url

This commit is contained in:
ralf 2023-01-30 16:50:05 +01:00
parent cc885c343f
commit 9ad73f1ea1
2 changed files with 7 additions and 1 deletions

View File

@ -860,7 +860,8 @@ class Ldap
if ($param['type'] !== 'groups')
{
$allValues = $this->vlvSortQuery($this->user_context, $filter,
['uid', 'uidNumber', 'givenname', 'sn', static::MAIL_ATTR, 'shadowExpire', 'createtimestamp', 'modifytimestamp', 'objectclass', 'gidNumber'],
['uid', 'uidNumber', 'givenname', 'sn', static::MAIL_ATTR, 'shadowExpire', 'createtimestamp',
'modifytimestamp', 'objectclass', 'gidNumber', 'jpegphoto'],
$order_by, $start, $offset, $totalcount);
$utc_diff = date('Z');
@ -881,6 +882,7 @@ class Ldap
'account_created' => isset($allVals['createtimestamp'][0]) ? self::accounts_ldap2ts($allVals['createtimestamp'][0]) : null,
'account_modified' => isset($allVals['modifytimestamp'][0]) ? self::accounts_ldap2ts($allVals['modifytimestamp'][0]) : null,
'account_primary_group' => (string)-$allVals['gidnumber'][0],
'account_has_photo' => !empty($allVals['jpegphoto'][0])
);
//error_log(__METHOD__."() ldap=".array2string($allVals)." --> account=".array2string($account));
if ($param['active'] && !$this->frontend->is_active($account))

View File

@ -1310,6 +1310,10 @@ class Ldap
$bin = ldap_get_values_len($this->ds,ldap_first_entry($this->ds,$result),'jpegphoto');
$contact['jpegphoto'] = $bin[0];
}
else
{
$contact['jpegphoto'] = isset($entry['jpegphoto'][0]);
}
$matches = null;
if(preg_match('/cn=([^,]+),'.preg_quote($this->personalContactsDN,'/').'$/i',$entry['dn'],$matches))
{