Skip to content

Commit

Permalink
SEBSP-182 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Dec 11, 2024
1 parent 037ea8b commit 1ef877d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import ch.ethz.seb.sebserver.gbl.model.user.TokenLoginInfo;
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
import ch.ethz.seb.sebserver.gbl.util.Result;
import ch.ethz.seb.sebserver.webservice.servicelayer.session.ExamFinishedEvent;
import org.springframework.context.event.EventListener;

/** Service used to maintain Teacher Ad-Hoc Accounts */
public interface TeacherAccountService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.TeacherAccountService;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ExamDAO;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserDAO;
import ch.ethz.seb.sebserver.webservice.servicelayer.session.ExamFinishedEvent;
import ch.ethz.seb.sebserver.webservice.servicelayer.session.ScreenProctoringService;
import ch.ethz.seb.sebserver.webservice.weblayer.oauth.AdminAPIClientDetails;
import io.jsonwebtoken.Claims;
Expand Down Expand Up @@ -133,7 +134,9 @@ public Result<String> getOneTimeTokenForTeacherAccount(
final AdHocAccountData adHocAccountData,
final boolean createIfNotExists) {

// TODO check if Exam is running, if not deny access
if (exam.status != Exam.ExamStatus.RUNNING) {
return Result.ofError(new IllegalStateException("Exam is not running"));
}

return this.userDAO
.byModelId(getTeacherAccountIdentifier(exam, adHocAccountData))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public FullLmsIntegrationService.TokenLoginResponse getOneTimeLoginToken(

final String token = this.fullLmsIntegrationService
.getOneTimeLoginToken(lmsUUId, courseId, quizId, adHocAccountData)
.onError(error -> log.error("Failed to create ad-hoc account with one time login token, error: {}", error.getMessage()))
.onError(error -> log.warn("Failed to create ad-hoc account with one time login token, error: {}", error.getMessage()))
.getOrThrow();

return new FullLmsIntegrationService.TokenLoginResponse(
Expand Down

0 comments on commit 1ef877d

Please sign in to comment.