viewerIsStudent()) { $route = 'course/gradebook/students'; } elseif ($this->viewerIsLecturer()) { $route = 'course/gradebook/lecturers'; } else { throw new AccessDeniedException(); } $this->redirect($route); } }