Skip to content

Commit

Permalink
Development: Add missing security annotation to lecture ingestion RES…
Browse files Browse the repository at this point in the history
…T endpoint
  • Loading branch information
krusche committed Oct 19, 2024
1 parent 53692bc commit f0d60cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.tum.cit.aet.artemis.lecture.web;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_IRIS;

import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -40,6 +41,7 @@
import de.tum.cit.aet.artemis.core.security.annotations.EnforceAtLeastEditor;
import de.tum.cit.aet.artemis.core.security.annotations.EnforceAtLeastInstructor;
import de.tum.cit.aet.artemis.core.security.annotations.EnforceAtLeastStudent;
import de.tum.cit.aet.artemis.core.security.annotations.enforceRoleInCourse.EnforceAtLeastInstructorInCourse;
import de.tum.cit.aet.artemis.core.service.AuthorizationCheckService;
import de.tum.cit.aet.artemis.core.util.HeaderUtil;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
Expand Down Expand Up @@ -261,13 +263,15 @@ public ResponseEntity<Lecture> importLecture(@PathVariable long sourceLectureId,

/**
* POST /courses/{courseId}/ingest
* This endpooint is for starting the ingestion of all lectures or only one lecture when triggered in Artemis.
* This endpoint is for starting the ingestion of all lectures or only one lecture when triggered in Artemis.
*
* @param courseId the ID of the course for which all lectures should be ingested in pyris
* @param lectureId If this id is present then only ingest this one lecture of the respective course
* @return the ResponseEntity with status 200 (OK) and a message success or null if the operation failed
*/
@Profile(PROFILE_IRIS)
@PostMapping("courses/{courseId}/ingest")
@EnforceAtLeastInstructorInCourse
public ResponseEntity<Boolean> ingestLectures(@PathVariable Long courseId, @RequestParam(required = false) Optional<Long> lectureId) {
log.debug("REST request to ingest lectures of course : {}", courseId);
Course course = courseRepository.findByIdWithLecturesAndLectureUnitsElseThrow(courseId);
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/lecture/lecture-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class LectureDetailComponent implements OnInit, OnDestroy {
}
}
/**
* Trigger the Ingeston of this Lecture in Iris.
* Trigger the ingestion of this lecture in Iris.
*/
ingestLectureInPyris() {
this.lectureService.ingestLecturesInPyris(this.lecture.course!.id!, this.lecture.id).subscribe({
Expand Down

0 comments on commit f0d60cb

Please sign in to comment.