Skip to content
Snippets Groups Projects
Commit 7e2012dd authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Add some fallbacks in case of missing attributes

We don't allow null here sothings would fail if the attribute is missing
in LDAP.
parent b1ada483
No related branches found
No related tags found
No related merge requests found
Pipeline #99093 passed
...@@ -264,12 +264,12 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface ...@@ -264,12 +264,12 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface
// $this->dispatcher->dispatch($preEvent, PersonFromUserItemPreEvent::NAME); // $this->dispatcher->dispatch($preEvent, PersonFromUserItemPreEvent::NAME);
// $user = $preEvent->getUser(); // $user = $preEvent->getUser();
$identifier = $user->getFirstAttribute($this->identifierAttributeName); $identifier = $user->getFirstAttribute($this->identifierAttributeName) ?? '';
$person = new Person(); $person = new Person();
$person->setIdentifier($identifier); $person->setIdentifier($identifier);
$person->setGivenName($user->getFirstAttribute($this->givenNameAttributeName)); $person->setGivenName($user->getFirstAttribute($this->givenNameAttributeName) ?? '');
$person->setFamilyName($user->getFirstAttribute($this->familyNameAttributeName)); $person->setFamilyName($user->getFirstAttribute($this->familyNameAttributeName) ?? '');
if ($this->emailAttributeName !== '') { if ($this->emailAttributeName !== '') {
$person->setEmail($user->getFirstAttribute($this->emailAttributeName) ?? ''); $person->setEmail($user->getFirstAttribute($this->emailAttributeName) ?? '');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment