From ded14e0945773d743c2f642952e655d46b466d25 Mon Sep 17 00:00:00 2001
From: Stephan Kergomard <webmaster@kergomard.ch>
Date: Thu, 14 Dec 2023 19:19:15 +0100
Subject: [PATCH] BAC: Fix Importing Roles With Missing Rights

See: https://mantis.ilias.de/view.php?id=37208
---
 Services/AccessControl/classes/class.ilRoleXmlImporter.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Services/AccessControl/classes/class.ilRoleXmlImporter.php b/Services/AccessControl/classes/class.ilRoleXmlImporter.php
index 6e8c7cd9e8e7..1bb0a239f020 100644
--- a/Services/AccessControl/classes/class.ilRoleXmlImporter.php
+++ b/Services/AccessControl/classes/class.ilRoleXmlImporter.php
@@ -162,8 +162,12 @@ public function importSimpleXml(SimpleXMLElement $role)
 
         foreach ($role->operations as $sxml_operations) {
             foreach ($sxml_operations as $sxml_op) {
+                $operation = trim((string) $sxml_op);
+                if (!array_key_exists($operation, $operations)) {
+                    continue;
+                }
                 $ops_group = (string) $sxml_op['group'];
-                $ops_id = (int) $operations[trim((string) $sxml_op)];
+                $ops_id = (int) $operations[$operation];
                 $ops = trim((string) $sxml_op);
                 
                 if ($ops_group and $ops_id) {