diff --git a/backend/controllers/committeeController.ts b/backend/controllers/committeeController.ts index 297e82a..4f7e542 100644 --- a/backend/controllers/committeeController.ts +++ b/backend/controllers/committeeController.ts @@ -1,7 +1,11 @@ import { NextFunction, Request, Response } from 'express' import { CustomError, UnauthorizedUserError } from 'ntnui-tools/customError' import { CommitteeModel } from '../models/Committee' -import { ELECTION_COMMITTEE_ID, MAIN_BOARD_ID } from '../utils/constants' +import { + ELECTION_COMMITTEE_ID, + MAIN_BOARD_ID, + LAW_COMMITTEE_ID, +} from '../utils/constants' import { RequestWithNtnuiNo } from '../utils/request' import { getUserRoleInCommitteeByUserId } from '../utils/userCommittee' @@ -32,9 +36,11 @@ async function acceptAdmissions( // If user is organizer, allow toggle of all except main board (userCommittee.committee === MAIN_BOARD_ID && committee._id !== MAIN_BOARD_ID) || - // If user part of election committee, allow toggle of own and main board + // If user part of election committee, allow toggle of own, main board and the law committee (userCommittee.committee === ELECTION_COMMITTEE_ID && - committee._id === MAIN_BOARD_ID) || + (committee._id === userCommittee.committee || + committee._id === MAIN_BOARD_ID || + committee._id === LAW_COMMITTEE_ID)) || // If user is board member of the committee and is not in the main board (userCommittee.committee === committee._id && committee._id !== MAIN_BOARD_ID) diff --git a/backend/fixtures/development/committees.json b/backend/fixtures/development/committees.json index 43efb64..a8a679c 100644 --- a/backend/fixtures/development/committees.json +++ b/backend/fixtures/development/committees.json @@ -78,5 +78,17 @@ "deputy_board_member" ], "accepts_admissions": false + }, + { + "_id": 11, + "name": "Lovutvalget", + "slug": "lovutvalget", + "access_roles": [ + "deputy_leader", + "cashier", + "board_member", + "deputy_board_member" + ], + "accepts_admissions": true } ] diff --git a/backend/fixtures/production/committees.json b/backend/fixtures/production/committees.json index 5116f00..3dea241 100644 --- a/backend/fixtures/production/committees.json +++ b/backend/fixtures/production/committees.json @@ -104,5 +104,12 @@ "slug": "baneutvalget", "access_roles": ["deputy_leader"], "accepts_admissions": true + }, + { + "_id": 72, + "name": "Lovutvalget", + "slug": "lovutvalget", + "access_roles": ["deputy_leader"], + "accepts_admissions": true } ] diff --git a/backend/utils/constants.ts b/backend/utils/constants.ts index 51195ce..4c61e82 100644 --- a/backend/utils/constants.ts +++ b/backend/utils/constants.ts @@ -1,8 +1,10 @@ /* eslint-disable no-console */ const MAIN_BOARD_ID = Number(process.env.MAIN_BOARD_ID) || 52 const ELECTION_COMMITTEE_ID = Number(process.env.ELECTION_COMMITTEE_ID) || 71 +const LAW_COMMITTEE_ID = Number(process.env.LAW_COMMITTEE_ID) || 72 console.log(`🔗 MAIN_BOARD_ID set to ${MAIN_BOARD_ID}`) console.log(`🔗 ELECTION_COMMITTEE_ID set to ${ELECTION_COMMITTEE_ID}`) +console.log(`🔗 LAW_COMMITTEE_ID set to ${LAW_COMMITTEE_ID}`) -export { MAIN_BOARD_ID, ELECTION_COMMITTEE_ID } +export { MAIN_BOARD_ID, ELECTION_COMMITTEE_ID, LAW_COMMITTEE_ID } diff --git a/frontend/src/pages/AdmissionStatus.tsx b/frontend/src/pages/AdmissionStatus.tsx index d476252..47fa194 100644 --- a/frontend/src/pages/AdmissionStatus.tsx +++ b/frontend/src/pages/AdmissionStatus.tsx @@ -142,11 +142,13 @@ function AdmissionStatus() { committee.slug !== 'valgkomiteen' && committee.slug !== 'hovedstyret' ) }) - // Election committee can see main board + // Election committee can see main board and the law committee } else if (locationState.isElectionCommittee) { allCommittees = await getAllCommittees() allCommittees = allCommittees.filter((committee: ICommittee) => { - return committee.slug === 'hovedstyret' + return ( + committee.slug === 'hovedstyret' || committee.slug === 'lovutvalget' + ) }) // Include the users other committees const committeesRes = await getUserCommittees()