Skip to content
Snippets Groups Projects

Add a redirect to the course enroll page for labs

Make sure to read our contributing guide

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
546 546 @ExceptionHandler(AccessDeniedException.class)
547 547 public String notInLab(@AuthenticatedUser User user, HttpServletRequest request,
548 548 Exception e) {
549 Pattern testPattern = Pattern.compile("/lab/([0-9]+)/*");
549 Pattern testPattern = Pattern.compile("/lab/([0-9]+)[/]?.*");
550 550 Matcher matcher = testPattern.matcher(request.getRequestURI());
551
551 552 if (matcher.matches() && matcher.groupCount() == 1) {
552 Course course = labRepository.findById(Long.parseLong(matcher.group(1))).orElseThrow()
553 .getCourse();
554 return "redirect:/course/" + course.getId() + "/enroll";
553 Long labId = Long.parseLong(matcher.group(1));
  • 546 546 @ExceptionHandler(AccessDeniedException.class)
    547 547 public String notInLab(@AuthenticatedUser User user, HttpServletRequest request,
    548 548 Exception e) {
    549 Pattern testPattern = Pattern.compile("/lab/([0-9]+)/*");
    549 Pattern testPattern = Pattern.compile("/lab/([0-9]+)[/]?.*");
  • Please register or sign in to reply
    Loading