diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/course/members.php | 26 | ||||
| -rw-r--r-- | app/controllers/course/statusgroups.php | 5 |
2 files changed, 19 insertions, 12 deletions
diff --git a/app/controllers/course/members.php b/app/controllers/course/members.php index bcbea42..822f4a4 100644 --- a/app/controllers/course/members.php +++ b/app/controllers/course/members.php @@ -93,10 +93,6 @@ class Course_MembersController extends AuthenticatedController public function index_action() { - if (!$this->is_tutor && $this->config->COURSE_MEMBERS_HIDE) { - throw new AccessDeniedException(); - } - $course = Course::find($this->course_id); $this->sort_by = Request::option('sortby', 'nachname'); $this->order = Request::option('order', 'desc'); @@ -1820,7 +1816,7 @@ class Course_MembersController extends AuthenticatedController $options = new OptionsWidget(); $options->addCheckbox( _('Diese Seite für Studierende verbergen'), - $this->config->COURSE_MEMBERS_HIDE, + $this->getToolActivation()->getVisibilityPermission() === 'tutor', $this->url_for('course/members/course_members_hide/1'), $this->url_for('course/members/course_members_hide/0'), ['title' => _('Über diese Option können Sie die Teilnehmendenliste für Studierende der Veranstaltung unsichtbar machen')] @@ -1916,7 +1912,13 @@ class Course_MembersController extends AuthenticatedController throw new AccessDeniedException(); } - $this->config->store('COURSE_MEMBERS_HIDE', $state); + $tool_activation = $this->getToolActivation(); + if ($state) { + $tool_activation->setVisibilityPermission(ToolActivation::VISIBILITY_PERMISSION_TEACHERS); + } else { + $tool_activation->setVisibilityPermission(ToolActivation::VISIBILITY_PERMISSION_STUDENTS); + } + $tool_activation->store(); $this->redirect($this->indexURL()); } @@ -2187,7 +2189,6 @@ class Course_MembersController extends AuthenticatedController return sprintf('%s %s', $directionString, $log_level); } - /** * Checks whether a tutor is attempting to add or remove tutors or * instructors. @@ -2206,4 +2207,15 @@ class Course_MembersController extends AuthenticatedController } } + private function getToolActivation(): ToolActivation + { + return ToolActivation::findOneBySQL( + "range_id = ? AND range_type = 'course' AND plugin_id IN ( + SELECT pluginid + FROM plugins + WHERE pluginclassname = 'CoreParticipants' + )", + [$this->course_id] + ); + } } diff --git a/app/controllers/course/statusgroups.php b/app/controllers/course/statusgroups.php index df8c86e..cbd80ad 100644 --- a/app/controllers/course/statusgroups.php +++ b/app/controllers/course/statusgroups.php @@ -38,11 +38,6 @@ class Course_StatusgroupsController extends AuthenticatedController $this->is_tutor = $GLOBALS['perm']->have_studip_perm('tutor', $this->course_id); $this->is_autor = $GLOBALS['perm']->have_studip_perm('autor', $this->course_id); - // Hide groups page? - if (!$this->is_tutor && $this->config->COURSE_MEMBERS_HIDE) { - throw new AccessDeniedException(); - } - // Check lock rules $this->is_locked = LockRules::Check($this->course_id, 'groups'); $this->is_participants_locked = LockRules::Check($this->course_id, 'participants'); |
