Skip to content

Commit ce4e849

Browse files
committed
Update code to use the attribute converter hub
1 parent 7c84721 commit ce4e849

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/User/Manager.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ public function findUsersByUsername($uid) {
567567

568568
$escapedUid = $this->access->escapeFilterPart($uid);
569569
$attrFilters = [];
570+
$converterHub = ConverterHub::getDefaultConverterHub();
570571
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);
572+
if ($converterHub->hasConverter($attr)) {
573+
$attrFilters[] = "{$attr}=" . $converterHub->str2filter($attr, $uid);
574574
} else {
575575
$attrFilters[] = "{$attr}={$escapedUid}";
576576
}
@@ -609,11 +609,13 @@ public function findUsersByUsername($uid) {
609609
*/
610610
private function getValueFromEntry($ldapEntry, $attrs) {
611611
$chosenValue = null;
612+
$converterHub = ConverterHub::getDefaultConverterHub();
613+
612614
foreach ($attrs as $attr) {
613615
if (isset($ldapEntry[$attr][0])) {
614616
$chosenValue = $ldapEntry[$attr][0];
615-
if ($attr === 'objectguid' || $attr === 'guid') {
616-
$chosenValue = Access::binGUID2str($chosenValue);
617+
if ($converterHub->hasConverter($attr)) {
618+
$chosenValue = $converterHub->bin2str($attr, $chosenValue);
617619
}
618620
break;
619621
}

0 commit comments

Comments
 (0)