|
1 | 1 | import { NextFunction, Request, Response } from 'express' |
2 | 2 | import { CustomError, UnauthorizedUserError } from 'ntnui-tools/customError' |
3 | 3 | import { CommitteeModel } from '../models/Committee' |
4 | | -import { ELECTION_COMMITTEE_ID, MAIN_BOARD_ID } from '../utils/constants' |
| 4 | +import { ELECTION_COMMITTEE_ID, MAIN_BOARD_ID, LAW_COMMITTEE_ID } from '../utils/constants' |
5 | 5 | import { RequestWithNtnuiNo } from '../utils/request' |
6 | 6 | import { getUserRoleInCommitteeByUserId } from '../utils/userCommittee' |
7 | 7 |
|
@@ -32,9 +32,11 @@ async function acceptAdmissions( |
32 | 32 | // If user is organizer, allow toggle of all except main board |
33 | 33 | (userCommittee.committee === MAIN_BOARD_ID && |
34 | 34 | committee._id !== MAIN_BOARD_ID) || |
35 | | - // If user part of election committee, allow toggle of own and main board |
| 35 | + // If user part of election committee, allow toggle of own, main board and the law committee |
36 | 36 | (userCommittee.committee === ELECTION_COMMITTEE_ID && |
37 | | - committee._id === MAIN_BOARD_ID) || |
| 37 | + committee._id === userCommittee.committee || |
| 38 | + committee._id === MAIN_BOARD_ID || |
| 39 | + committee._id === LAW_COMMITTEE_ID) ||
|
38 | 40 | // If user is board member of the committee and is not in the main board |
39 | 41 | (userCommittee.committee === committee._id && |
40 | 42 | committee._id !== MAIN_BOARD_ID) |
|
0 commit comments