|
28 | 28 | use OC\Cache\CappedMemoryCache; |
29 | 29 | use OC\ServerNotAvailableException; |
30 | 30 | use OCA\User_LDAP\Access; |
| 31 | +use OCA\User_LDAP\Attributes\ConverterHub; |
31 | 32 | use OCA\User_LDAP\Connection; |
32 | 33 | use OCA\User_LDAP\Exceptions\DoesNotExistOnLDAPException; |
33 | 34 | use OCA\User_LDAP\FilesystemHelper; |
@@ -567,10 +568,10 @@ public function findUsersByUsername($uid) { |
567 | 568 |
|
568 | 569 | $escapedUid = $this->access->escapeFilterPart($uid); |
569 | 570 | $attrFilters = []; |
| 571 | + $converterHub = ConverterHub::getDefaultConverterHub(); |
570 | 572 | foreach ($usernameAttrs as $attr) { |
571 | | - if ($attr === 'objectguid' || $attr === 'guid') { |
572 | | - // needs special formatting because we need to send as binary data |
573 | | - $attrFilters[] = "{$attr}=" . $this->access->formatGuid2ForFilterUser($uid); |
| 573 | + if ($converterHub->hasConverter($attr)) { |
| 574 | + $attrFilters[] = "{$attr}=" . $converterHub->str2filter($attr, $uid); |
574 | 575 | } else { |
575 | 576 | $attrFilters[] = "{$attr}={$escapedUid}"; |
576 | 577 | } |
@@ -609,11 +610,13 @@ public function findUsersByUsername($uid) { |
609 | 610 | */ |
610 | 611 | private function getValueFromEntry($ldapEntry, $attrs) { |
611 | 612 | $chosenValue = null; |
| 613 | + $converterHub = ConverterHub::getDefaultConverterHub(); |
| 614 | + |
612 | 615 | foreach ($attrs as $attr) { |
613 | 616 | if (isset($ldapEntry[$attr][0])) { |
614 | 617 | $chosenValue = $ldapEntry[$attr][0]; |
615 | | - if ($attr === 'objectguid' || $attr === 'guid') { |
616 | | - $chosenValue = Access::binGUID2str($chosenValue); |
| 618 | + if ($converterHub->hasConverter($attr)) { |
| 619 | + $chosenValue = $converterHub->bin2str($attr, $chosenValue); |
617 | 620 | } |
618 | 621 | break; |
619 | 622 | } |
|
0 commit comments