fix(backend): Merge-conflicten opgelost.
This commit is contained in:
parent
8c387d6811
commit
fb3c37ce5a
8 changed files with 79 additions and 49 deletions
|
@ -0,0 +1,23 @@
|
|||
import {authorize} from "./auth-checks";
|
||||
import {AuthenticationInfo} from "../authentication-info";
|
||||
import {AuthenticatedRequest} from "../authenticated-request";
|
||||
import {getGroup} from "../../../services/groups";
|
||||
|
||||
/**
|
||||
* Only allows requests whose learning path personalization query parameters ('forGroup' / 'assignmentNo' / 'classId')
|
||||
* are
|
||||
* - either not set
|
||||
* - or set to a group the user is in,
|
||||
* - or set to anything if the user is a teacher.
|
||||
*/
|
||||
export const onlyAllowPersonalizationForOwnGroup = authorize(
|
||||
async (auth: AuthenticationInfo, req: AuthenticatedRequest) => {
|
||||
const {forGroup, assignmentNo, classId} = req.params;
|
||||
if (forGroup && assignmentNo && classId) {
|
||||
const group = getGroup(forGroup, parseInt(assignmentNo), classId, false);
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue