Commit 3d572923 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajustement de la méthode de recherche

parent 64f72ade
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -31,23 +31,23 @@ class LdapIndividu implements RechercheIndividuResultatInterface

    public function getId()
    {
        return $this->people->getId();
        return $this->people['uid'];
    }

    public function getUsername(string $attribut = "supannAliasLogin")
    {
        return $this->people->get('supannAliasLogin');
        return $this->people[$attribut];
    }

    public function getDisplayname()
    {
        $tmp_name = $this->people->get('sn');
        $tmp_name = $this->people['displayName'];
        if (!is_string($tmp_name)) $tmp_name = implode("-", $this->people->get('sn'));
        return $tmp_name . " " . $this->people->get('givenName');
        return $tmp_name; //$tmp_name . " " . $this->people->get('givenName');
    }

    public function getEmail()
    {
        return $this->people->get('mail');
        return $this->people['mail'];
    }
}
 No newline at end of file
+8 −3
Original line number Diff line number Diff line
@@ -22,13 +22,17 @@ class LdapService implements RechercheIndividuServiceInterface
     */
    public function findById($id)
    {
        $filter = PeopleFilter::uid($id);
        /**
         * @var PeopleEntity $people
         */
        $people = $this->ldapPeopleService->get($id);

        /** TODO retirer ce contournement une fois le problème compris */
//        $people = $this->ldapPeopleService->get($id);
        $people = $this->ldapPeopleService->searchAttributes($filter, ['id', 'uid', 'supannaliaslogin', 'supannAliasLogin','displayName', 'mail']);
        $peep = $people[$id];
        $p = new LdapIndividu();
        $p->setPeople($people);
        $p->setPeople($peep);
        return $p;
    }

@@ -45,7 +49,8 @@ class LdapService implements RechercheIndividuServiceInterface
        );
        /** @var PeopleService $ldapService */
        try {
            $people = $this->ldapPeopleService->search($filter);
            $people = $this->ldapPeopleService->searchAttributes($filter, ['id', 'uid', 'supannaliaslogin', 'supannAliasLogin','displayName', 'mail']);
//            $people = $this->ldapPeopleService->search($filter);
        } catch (Exception $e) {
            throw new RuntimeException("Un exception ldap est survenue :", $e);
        }