Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Fix wrong result subscription for exam exercises #9453

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import de.tum.cit.aet.artemis.core.security.jwt.TokenProvider;
import de.tum.cit.aet.artemis.core.service.AuthorizationCheckService;
import de.tum.cit.aet.artemis.exam.repository.ExamRepository;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
import de.tum.cit.aet.artemis.exercise.domain.participation.StudentParticipation;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.exercise.repository.StudentParticipationRepository;
Expand Down Expand Up @@ -309,8 +308,7 @@ private boolean allowSubscription(@Nullable Principal principal, String destinat

// TODO: Is it right that TAs are not allowed to subscribe to exam exercises?
if (exerciseRepository.isExamExercise(exerciseId)) {
Exercise exercise = exerciseRepository.findByIdElseThrow(exerciseId);
return authorizationCheckService.isAtLeastInstructorInCourse(login, exercise.getCourseViaExerciseGroupOrCourseMember().getId());
return authorizationCheckService.isAtLeastInstructorInExercise(login, exerciseId);
}
else {
return authorizationCheckService.isAtLeastTeachingAssistantInExercise(login, exerciseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ <h3 jhiTranslate="artemisApp.exam.exercises"></h3>
[resultsPublished]="resultsArePublished"
[isPrinting]="isPrinting"
[isAfterResultsArePublished]="resultsArePublished"
[instructorView]="instructorView"
/>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h5 jhiTranslate="artemisApp.exam.examSummary.assessment"></h5>
<div class="col-md-8">
<h5 jhiTranslate="artemisApp.exam.examSummary.problemStatement"></h5>
@if (exercise.problemStatement) {
<jhi-programming-exercise-instructions [exercise]="exercise" [participation]="participation" />
<jhi-programming-exercise-instructions [exercise]="exercise" [participation]="participation" [personalParticipation]="!instructorView" />
}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export class ProgrammingExamSummaryComponent implements OnInit {

@Input() isAfterResultsArePublished?: boolean = false;

@Input() instructorView?: boolean = false;

readonly PROGRAMMING: ExerciseType = ExerciseType.PROGRAMMING;

protected readonly AssessmentType = AssessmentType;
Expand Down
Loading