package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.dto.SemesterDto;
import org.springframework.security.access.prepost.*;

import java.util.*;

public interface SemesterService {

    @PreAuthorize("hasRole('ADMIN')")
    SemesterDto create(SemesterDto semester);

    @PreAuthorize("isAuthenticated()")
    SemesterDto getCurrentSemester();

    @PreAuthorize("isAuthenticated()")
    SemesterDto getOrCreateCurrentSemester();

    @PreAuthorize("isAuthenticated()")
    List<SemesterDto> findAll();

    @PreAuthorize("isAuthenticated()")
    List<SemesterDto> findAllSince(SemesterDto semester);
}

@@ -276,81 +276,433 @@
     
-@PreAuthorize(%22isAuthenticated()%22)%0A    SemesterDto getCurrentSemester();%0A
+/**%0A     * Get the current semester, only use it in tests!%0A     *%0A     * Always use getOrCreateCurrentSemester:%0A     * it also checks if a new semester can be started and starts it automatically.%0A     */%0A    @PreAuthorize(%22isAuthenticated()%22)%0A    SemesterDto getCurrentSemester();%0A%0A    /**%0A     * Get the current semester.%0A     *%0A     * If a new semester can be started, the new semester will be started and returned.%0A     */
 %0A   

Add doc