Skip to content
Snippets Groups Projects
Commit ef6ac7f4 authored by Stefan Hugtenburg's avatar Stefan Hugtenburg
Browse files

Teacher should teach the course in question

parent 9b4de52d
No related branches found
No related tags found
No related merge requests found
......@@ -148,7 +148,7 @@ public class RequestService {
* @param request
*/
public void approve(User assistant, Request request, String comment) {
if (!request.getAssistant().equals(assistant) && !(assistant.isTeacher() || assistant.isAdmin())) {
if (!request.getAssistant().equals(assistant) && !(assistant.teaches(request.getAssignment().getCourse()) || assistant.isAdmin())) {
throw new IllegalArgumentException("You cannot approve a request that is not assigned to you.");
}
request.addEvent(new RequestApprovedEvent(request, assistant,LocalDateTime.now(), comment));
......@@ -163,7 +163,7 @@ public class RequestService {
* @param request
*/
public void reject(User assistant, Request request, String comment) {
if (!request.getAssistant().equals(assistant) && !(assistant.isTeacher() || assistant.isAdmin())) {
if (!request.getAssistant().equals(assistant) && !(assistant.teaches(request.getAssignment().getCourse()) || assistant.isAdmin())) {
throw new IllegalArgumentException("You cannot reject a request that is not assigned to you.");
}
request.addEvent(new RequestRejectedEvent(request, assistant,LocalDateTime.now(), comment));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment