fix: .js toevoegen aan imports
This commit is contained in:
parent
6847961688
commit
04fd54e3d6
25 changed files with 73 additions and 75 deletions
|
@ -1,7 +1,7 @@
|
|||
import { authorize } from './auth-checks';
|
||||
import { fetchClass } from '../../../services/classes';
|
||||
import { fetchAllGroups } from '../../../services/groups';
|
||||
import { mapToUsername } from '../../../interfaces/user';
|
||||
import { authorize } from './auth-checks.js';
|
||||
import { fetchClass } from '../../../services/classes.js';
|
||||
import { fetchAllGroups } from '../../../services/groups.js';
|
||||
import { mapToUsername } from '../../../interfaces/user.js';
|
||||
|
||||
/**
|
||||
* Expects the path to contain the path parameters 'classId' and 'id' (meaning the ID of the assignment).
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { AuthenticationInfo } from '../authentication-info';
|
||||
import { AuthenticatedRequest } from '../authenticated-request';
|
||||
import { AuthenticationInfo } from '../authentication-info.js';
|
||||
import { AuthenticatedRequest } from '../authenticated-request.js';
|
||||
import * as express from 'express';
|
||||
import { UnauthorizedException } from '../../../exceptions/unauthorized-exception';
|
||||
import { ForbiddenException } from '../../../exceptions/forbidden-exception';
|
||||
import { RequestHandler } from 'express';
|
||||
import { UnauthorizedException } from '../../../exceptions/unauthorized-exception.js';
|
||||
import { ForbiddenException } from '../../../exceptions/forbidden-exception.js';
|
||||
|
||||
/**
|
||||
* Middleware which rejects unauthenticated users (with HTTP 401) and authenticated users which do not fulfill
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { authorize } from './auth-checks';
|
||||
import { AuthenticationInfo } from '../authentication-info';
|
||||
import { AuthenticatedRequest } from '../authenticated-request';
|
||||
import { fetchClass } from '../../../services/classes';
|
||||
import { mapToUsername } from '../../../interfaces/user';
|
||||
import { authorize } from './auth-checks.js';
|
||||
import { AuthenticationInfo } from '../authentication-info.js';
|
||||
import { AuthenticatedRequest } from '../authenticated-request.js';
|
||||
import { fetchClass } from '../../../services/classes.js';
|
||||
import { mapToUsername } from '../../../interfaces/user.js';
|
||||
|
||||
async function teaches(teacherUsername: string, classId: string): Promise<boolean> {
|
||||
const clazz = await fetchClass(classId);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { authorize } from './auth-checks';
|
||||
import { fetchClass } from '../../../services/classes';
|
||||
import { fetchGroup } from '../../../services/groups';
|
||||
import { mapToUsername } from '../../../interfaces/user';
|
||||
import { authorize } from './auth-checks.js';
|
||||
import { fetchClass } from '../../../services/classes.js';
|
||||
import { fetchGroup } from '../../../services/groups.js';
|
||||
import { mapToUsername } from '../../../interfaces/user.js';
|
||||
|
||||
/**
|
||||
* Expects the path to contain the path parameters 'classid', 'assignmentid' and 'groupid'.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { authorize } from './auth-checks';
|
||||
import { AuthenticationInfo } from '../authentication-info';
|
||||
import { AuthenticatedRequest } from '../authenticated-request';
|
||||
import { requireFields } from '../../../controllers/error-helper';
|
||||
import { getLearningObjectId, getQuestionId } from '../../../controllers/questions';
|
||||
import { fetchQuestion } from '../../../services/questions';
|
||||
import { FALLBACK_SEQ_NUM } from '../../../config';
|
||||
import { fetchAnswer } from '../../../services/answers';
|
||||
import { mapToUsername } from '../../../interfaces/user';
|
||||
import { authorize } from './auth-checks.js';
|
||||
import { AuthenticationInfo } from '../authentication-info.js';
|
||||
import { AuthenticatedRequest } from '../authenticated-request.js';
|
||||
import { requireFields } from '../../../controllers/error-helper.js';
|
||||
import { getLearningObjectId, getQuestionId } from '../../../controllers/questions.js';
|
||||
import { fetchQuestion } from '../../../services/questions.js';
|
||||
import { FALLBACK_SEQ_NUM } from '../../../config.js';
|
||||
import { fetchAnswer } from '../../../services/answers.js';
|
||||
import { mapToUsername } from '../../../interfaces/user.js';
|
||||
|
||||
export const onlyAllowAuthor = authorize(
|
||||
(auth: AuthenticationInfo, req: AuthenticatedRequest) => (req.body as { author: string }).author === auth.username
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { LearningObjectIdentifier } from '../../../entities/content/learning-object-identifier';
|
||||
import { fetchSubmission } from '../../../services/submissions';
|
||||
import { AuthenticatedRequest } from '../authenticated-request';
|
||||
import { AuthenticationInfo } from '../authentication-info';
|
||||
import { authorize } from './auth-checks';
|
||||
import { FALLBACK_LANG } from '../../../config';
|
||||
import { mapToUsername } from '../../../interfaces/user';
|
||||
import { languageMap } from '@dwengo-1/common/util/language';
|
||||
import { LearningObjectIdentifier } from '../../../entities/content/learning-object-identifier.js';
|
||||
import { fetchSubmission } from '../../../services/submissions.js';
|
||||
import { AuthenticatedRequest } from '../authenticated-request.js';
|
||||
import { AuthenticationInfo } from '../authentication-info.js';
|
||||
import { authorize } from './auth-checks.js';
|
||||
import { FALLBACK_LANG } from '../../../config.js';
|
||||
import { mapToUsername } from '../../../interfaces/user.js';
|
||||
|
||||
export const onlyAllowSubmitter = authorize(
|
||||
(auth: AuthenticationInfo, req: AuthenticatedRequest) => (req.body as { submitter: string }).submitter === auth.username
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { authorize } from './auth-checks';
|
||||
import { AuthenticationInfo } from '../authentication-info';
|
||||
import { AuthenticatedRequest } from '../authenticated-request';
|
||||
import { authorize } from './auth-checks.js';
|
||||
import { AuthenticationInfo } from '../authentication-info.js';
|
||||
import { AuthenticatedRequest } from '../authenticated-request.js';
|
||||
|
||||
export const onlyAllowSenderOrReceiver = authorize(
|
||||
(auth: AuthenticationInfo, req: AuthenticatedRequest) => req.params.sender === auth.username || req.params.receiver === auth.username
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { authorize } from './auth-checks';
|
||||
import { AuthenticationInfo } from '../authentication-info';
|
||||
import { AuthenticatedRequest } from '../authenticated-request';
|
||||
import { authorize } from './auth-checks.js';
|
||||
import { AuthenticationInfo } from '../authentication-info.js';
|
||||
import { AuthenticatedRequest } from '../authenticated-request.js';
|
||||
|
||||
/**
|
||||
* Only allow the user whose username is in the path parameter "username" to access the endpoint.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue