From 0a29905557c8530d4f2d3a63ed250dfd69a189bb Mon Sep 17 00:00:00 2001
From: uhensler <urs.hensler@frentix.com>
Date: Wed, 1 Apr 2020 08:00:23 +0200
Subject: [PATCH] OO-4168: Do not show course tools if user has not booked the
 course yet

---
 .../org/olat/course/run/CourseRuntimeController.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/olat/course/run/CourseRuntimeController.java b/src/main/java/org/olat/course/run/CourseRuntimeController.java
index 715718bad3b..20697a223ea 100644
--- a/src/main/java/org/olat/course/run/CourseRuntimeController.java
+++ b/src/main/java/org/olat/course/run/CourseRuntimeController.java
@@ -855,13 +855,13 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
 			toolbarPanel.addTool(lecturesLink);
 		}
 		
-		if(!assessmentLock && !isGuestOnly) {
+		if(!assessmentLock && !isGuestOnly && userCourseEnv != null) {
 			participantListLink = LinkFactory.createToolLink("participantlist", translate("command.participant.list"), this, "o_cmembers_icon");
 			participantListLink.setVisible(cc.isParticipantListEnabled());
 			toolbarPanel.addTool(participantListLink);
 		}
 		
-		if(!assessmentLock) {
+		if(!assessmentLock && userCourseEnv != null) {
 			participantInfoLink = LinkFactory.createToolLink("participantinfo", translate("command.participant.info"), this, "o_infomsg_icon");
 			participantInfoLink.setVisible(cc.isParticipantInfoEnabled());
 			toolbarPanel.addTool(participantInfoLink);
@@ -873,25 +873,25 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
 			toolbarPanel.addTool(emailLink);
 		}
 		
-		if(!assessmentLock) {
+		if(!assessmentLock && userCourseEnv != null) {
 			blogLink = LinkFactory.createToolLink("blog", translate("command.blog"), this, "o_blog_icon");
 			blogLink.setVisible(cc.isBlogEnabled());
 			toolbarPanel.addTool(blogLink);
 		}
 		
-		if(!assessmentLock) {
+		if(!assessmentLock && userCourseEnv != null) {
 			wikiLink = LinkFactory.createToolLink("wiki", translate("command.wiki"), this, "o_wiki_icon");
 			wikiLink.setVisible(cc.isWikiEnabled());
 			toolbarPanel.addTool(wikiLink);
 		}
 		
-		if(!assessmentLock) {
+		if(!assessmentLock && userCourseEnv != null) {
 			forumLink = LinkFactory.createToolLink("forum", translate("command.forum"), this, "o_fo_icon");
 			forumLink.setVisible(cc.isForumEnabled());
 			toolbarPanel.addTool(forumLink);
 		}
 		
-		if(!assessmentLock) {
+		if(!assessmentLock && userCourseEnv != null) {
 			documentsLink = LinkFactory.createToolLink("documents", translate("command.documents"), this, "o_bc_icon");
 			documentsLink.setVisible(cc.isDocumentsEnabled());
 			toolbarPanel.addTool(documentsLink);
-- 
GitLab