package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.entity.*;
import org.springframework.security.access.prepost.*;
import org.springframework.stereotype.*;

import java.util.*;

@Service
public interface GradeService {

    @PreAuthorize("hasRole('LECTURER')")
    Grade getDefaultGradeForStudentAndCourse(Long studentId, Long courseId);

    @PreAuthorize("hasRole('LECTURER')")
    Grade saveNewGradeForStudentAndCourse(Grade grade);

    @PreAuthorize("hasRole('LECTURER')")
    List<Grade> getGradesForCourseOfLoggedInLecturer(Long courseId);

    @PreAuthorize("hasRole('STUDENT')")
    List<Grade> getGradesForLoggedInStudent();

    Grade getForValidation(String identifier);

    @PreAuthorize("isAuthenticated()")
    List<Grade> findAllOfStudent(Student student);
}

@@ -29,16 +29,84 @@
 rvice;%0A%0A
+import at.ac.tuwien.inso.controller.lecturer.GradeAuthorizationDTO;%0A
 import a
@@ -345,24 +345,56 @@
 rade
- getDefaultGrade
+AuthorizationDTO getDefaultGradeAuthorizationDTO
 ForS
@@ -530,16 +530,32 @@
 se(Grade
+AuthorizationDTO
  grade);
@@ -892,11 +892,84 @@
 tudent);
+%0A%0A    @PreAuthorize(%22isAuthenticated()%22)%0A    List%3CMark%3E getMarkOptions();
 %0A%7D%0A

Refactor for two factor authentification