From c0895118e1f57f21334e0cd205faa6d22a1b2739 Mon Sep 17 00:00:00 2001
From: Patrizio Bekerle <patrizio@bekerle.com>
Date: Mon, 31 Jan 2022 16:47:43 +0100
Subject: [PATCH] Add a default value for ldap-roles

---
 src/Service/LDAPApi.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/Service/LDAPApi.php b/src/Service/LDAPApi.php
index 25bfbe0..0dc83ea 100644
--- a/src/Service/LDAPApi.php
+++ b/src/Service/LDAPApi.php
@@ -298,6 +298,11 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface
         $person = $this->getCurrentPerson();
         if ($person !== null) {
             $roles = $person->getExtraData('ldap-roles');
+
+            if ($roles === null) {
+                return [];
+            }
+
             assert(is_array($roles));
 
             return $roles;
-- 
GitLab