From 4a952ddb48c04c6f2eb6ffec60f81172bc178f03 Mon Sep 17 00:00:00 2001
From: David Siegfried <david.siegfried@uni-vechta.de>
Date: Wed, 6 Nov 2024 12:04:00 +0000
Subject: [PATCH] prevent php-warnings in courseware-routes, fixes #4834

Closes #4834

Merge request studip/studip!3620
---
 .../JsonApi/Routes/Courseware/StructuralElementsSharedIndex.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/classes/JsonApi/Routes/Courseware/StructuralElementsSharedIndex.php b/lib/classes/JsonApi/Routes/Courseware/StructuralElementsSharedIndex.php
index 9ebf923d450..2be04115d8d 100644
--- a/lib/classes/JsonApi/Routes/Courseware/StructuralElementsSharedIndex.php
+++ b/lib/classes/JsonApi/Routes/Courseware/StructuralElementsSharedIndex.php
@@ -56,7 +56,7 @@ class StructuralElementsSharedIndex extends JsonApiController
             $add_content = false;
 
             foreach ($content->content_approval['users'] as $listedUserPerm) {
-                if ($listedUserPerm['id'] == $user->id && $listedUserPerm['read']) {
+                if ($listedUserPerm['id'] == $user->id && !empty($listedUserPerm['read'])) {
                     $add_content = true;
                 }
             }
-- 
GitLab