fix(backend): Bugs omtrent leerpad-endpoints opgelost

This commit is contained in:
Gerald Schmittinger 2025-05-13 01:02:53 +02:00
parent 6929288554
commit 1a768fedcc
6 changed files with 12 additions and 12 deletions

View file

@ -3,10 +3,10 @@ import { authorize } from "../auth";
import { AuthenticatedRequest } from "../authenticated-request";
import { AuthenticationInfo } from "../authentication-info";
export const onlyAdminsForLearningPath = authorize((auth: AuthenticationInfo, req: AuthenticatedRequest) => {
const adminsForLearningPath = learningPathService.getAdmins({
export const onlyAdminsForLearningPath = authorize(async (auth: AuthenticationInfo, req: AuthenticatedRequest) => {
const adminsForLearningPath = await learningPathService.getAdmins({
hruid: req.body.hruid,
language: req.body.language
});
return adminsForLearningPath && auth.username in adminsForLearningPath;
return adminsForLearningPath && adminsForLearningPath.includes(auth.username);
});