From cd1c3bc44032a2e81d6dc5e6292dec5a26ef3d78 Mon Sep 17 00:00:00 2001
From: Marcus <teachuos@luniki.de>
Date: Wed, 12 Oct 2022 06:44:12 +0200
Subject: [PATCH] Hide courseware tab in teachUOS course.

---
 TeachUOS.class.php | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/TeachUOS.class.php b/TeachUOS.class.php
index 371e43d..4a40d55 100644
--- a/TeachUOS.class.php
+++ b/TeachUOS.class.php
@@ -33,6 +33,16 @@ class TeachUOS extends StudipPlugin implements
             );
             $navigation->addSubNavigation("teachUOS", $teachUOS);
         }
+
+        // more setup if this plugin is active in this course
+        $contextId = \Context::getId();
+        if (\Context::getType() === \Context::COURSE && $this->isActivated($contextId)) {
+            if (!$GLOBALS['perm']->have_studip_perm('tutor', $contextId)) {
+                if (Navigation::hasItem('/course/courseware')) {
+                    Navigation::removeItem('/course/courseware');
+                }
+            }
+        }
     }
 
     /**
-- 
GitLab