From 385097907759a13650fe54c3b50b7f343e291bec Mon Sep 17 00:00:00 2001 From: Daniel Haag <daniel.haag@uibk.ac.at> Date: Mon, 26 Aug 2019 12:10:03 +0200 Subject: [PATCH] openolat#71: hide edit streams functions for non admins --- .../nodes/livestream/LiveStreamSecurityCallbackFactory.java | 3 ++- .../course/nodes/livestream/ui/LiveStreamConfigController.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/olat/course/nodes/livestream/LiveStreamSecurityCallbackFactory.java b/src/main/java/org/olat/course/nodes/livestream/LiveStreamSecurityCallbackFactory.java index 583dbeb1bb3..bd28d9ad7b9 100644 --- a/src/main/java/org/olat/course/nodes/livestream/LiveStreamSecurityCallbackFactory.java +++ b/src/main/java/org/olat/course/nodes/livestream/LiveStreamSecurityCallbackFactory.java @@ -34,7 +34,8 @@ public class LiveStreamSecurityCallbackFactory { public static LiveStreamSecurityCallback createSecurityCallback(UserCourseEnvironment userCourseEnv, ModuleConfiguration config) { boolean canViewStreams = true; - boolean canEditStreams = + // UIBK: we currently only allow olat admins to change/add streams, remove the first condition here to revert: + boolean canEditStreams = userCourseEnv.getIdentityEnvironment().getRoles().isAdministrator() && userCourseEnv.isAdmin() || (userCourseEnv.isCoach() && config.getBooleanSafe(LiveStreamCourseNode.CONFIG_COACH_CAN_EDIT)); return createSecurityCallback(canViewStreams, canEditStreams); diff --git a/src/main/java/org/olat/course/nodes/livestream/ui/LiveStreamConfigController.java b/src/main/java/org/olat/course/nodes/livestream/ui/LiveStreamConfigController.java index 0c417d030d9..aa4da7787e3 100644 --- a/src/main/java/org/olat/course/nodes/livestream/ui/LiveStreamConfigController.java +++ b/src/main/java/org/olat/course/nodes/livestream/ui/LiveStreamConfigController.java @@ -71,6 +71,8 @@ public class LiveStreamConfigController extends FormBasicController { coachCanEditEl = uifactory.addCheckboxesVertical("config.coach.edit", formLayout, ENABLED_KEYS, translateAll(getTranslator(), ENABLED_KEYS), 1); boolean coachCanEdit = config.getBooleanSafe(LiveStreamCourseNode.CONFIG_COACH_CAN_EDIT); + // UIBK do now allow normal users to set this option as currently only admins can edit stream events + coachCanEditEl.setVisible(ureq.getUserSession().getRoles().isAdministrator()); coachCanEditEl.select(ENABLED_KEYS[0], coachCanEdit); uifactory.addFormSubmitButton("save", formLayout); -- GitLab