fix: fixed syntax & typescript errors
This commit is contained in:
parent
a4ccae6c0d
commit
b4b9abcc48
1 changed files with 5 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
import {authorize} from "./auth-checks";
|
||||
import {AuthenticationInfo} from "../authentication-info";
|
||||
import {AuthenticatedRequest} from "../authenticated-request";
|
||||
import {getGroup} from "../../../services/groups";
|
||||
import {fetchGroup, getGroup} from "../../../services/groups";
|
||||
|
||||
/**
|
||||
* Only allows requests whose learning path personalization query parameters ('forGroup' / 'assignmentNo' / 'classId')
|
||||
|
@ -13,9 +13,10 @@ import {getGroup} from "../../../services/groups";
|
|||
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);
|
||||
|
||||
if (auth.accountType === "student" && forGroup && assignmentNo && classId) {
|
||||
// TODO: groupNumber?
|
||||
// const group = await fetchGroup(Number(classId), Number(assignmentNo), )
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue