@@ -36,7 +36,8 @@ public function __invoke(Request $request, Response $response, $args)
3636
3737 if (empty ($ series )) {
3838 // only tutor or above should be able to trigger this series creation!
39- if ($ perm ->have_studip_perm ('tutor ' , $ course_id )) {
39+ $ required_course_perm = \Config::get ()->OPENCAST_TUTOR_EPISODE_PERM ? 'tutor ' : 'dozent ' ;
40+ if ($ perm ->have_studip_perm ($ required_course_perm , $ course_id )) {
4041 // No series for this course yet! Create one!
4142 $ config_id = \Config::get ()->OPENCAST_DEFAULT_SERVER ;
4243 $ series_client = new SeriesClient ($ config_id );
@@ -53,16 +54,31 @@ public function __invoke(Request $request, Response $response, $args)
5354 }
5455 }
5556
57+ // Default Course Episodes Visibility.
58+ // The course specific config option OPENCAST_COURSE_DEFAULT_EPISODES_VISIBILITY has 3 possible values:
59+ // - default: use the default value from the config (OPENCAST_HIDE_EPISODES) at the time!
60+ // - visible: show the episodes to students by default
61+ // - hidden: hide the episodes from students by default
62+ // Getting with the default value from the config (OPENCAST_HIDE_EPISODES).
63+ $ course_hide_episodes = \Config::get ()->OPENCAST_HIDE_EPISODES ;
64+ $ course_default_episodes_visibility = \CourseConfig::get ($ course_id )->OPENCAST_COURSE_DEFAULT_EPISODES_VISIBILITY
65+ ?? 'default ' ;
66+ if ($ course_default_episodes_visibility !== 'default ' ) {
67+ $ course_hide_episodes = $ course_default_episodes_visibility === 'hidden ' ? true : false ;
68+ }
69+
5670 $ results = [
5771 'series ' => [
5872 'series_id ' => $ series ->series_id ,
5973 ],
60- 'workflow ' => SeminarWorkflowConfiguration::getWorkflowForCourse ($ course_id ),
61- 'edit_allowed ' => Perm::editAllowed ($ course_id ),
62- 'upload_allowed ' => Perm::uploadAllowed ($ course_id ),
63- 'upload_enabled ' => \CourseConfig::get ($ course_id )->OPENCAST_ALLOW_STUDENT_UPLOAD ? 1 : 0 ,
64- 'has_default_playlist ' => Helpers::checkCourseDefaultPlaylist ($ course_id ),
65- 'scheduling_allowed ' => Perm::schedulingAllowed ($ course_id )
74+ 'workflow ' => SeminarWorkflowConfiguration::getWorkflowForCourse ($ course_id ),
75+ 'edit_allowed ' => Perm::editAllowed ($ course_id ),
76+ 'upload_allowed ' => Perm::uploadAllowed ($ course_id ),
77+ 'upload_enabled ' => \CourseConfig::get ($ course_id )->OPENCAST_ALLOW_STUDENT_UPLOAD ? 1 : 0 ,
78+ 'has_default_playlist ' => Helpers::checkCourseDefaultPlaylist ($ course_id ),
79+ 'scheduling_allowed ' => Perm::schedulingAllowed ($ course_id ),
80+ 'course_hide_episodes ' => $ course_hide_episodes , // Use this in a course instead of OPENCAST_HIDE_EPISODES!
81+ 'course_default_episodes_visibility ' => $ course_default_episodes_visibility ,
6682 ];
6783
6884 return $ this ->createResponse ($ results , $ response );
0 commit comments