|
1 | | -import { execCouncilGroupId, execCouncilTestingGroupId, genericConfig, officersGroupId, officersGroupTestingId } from "../../common/config.js"; |
| 1 | +import { |
| 2 | + execCouncilGroupId, |
| 3 | + execCouncilTestingGroupId, |
| 4 | + genericConfig, |
| 5 | + officersGroupId, |
| 6 | + officersGroupTestingId, |
| 7 | +} from "../../common/config.js"; |
2 | 8 | import { |
3 | 9 | BaseError, |
4 | 10 | EntraGroupError, |
@@ -192,16 +198,29 @@ export async function modifyGroup( |
192 | 198 | }); |
193 | 199 | } |
194 | 200 | // if adding to exec group, check that all exec members we want to add are paid members |
195 | | - const paidMemberRequiredGroups = [execCouncilGroupId, execCouncilTestingGroupId, officersGroupId, officersGroupTestingId] |
196 | | - if (paidMemberRequiredGroups.includes(group) && action === EntraGroupActions.ADD) { |
| 201 | + const paidMemberRequiredGroups = [ |
| 202 | + execCouncilGroupId, |
| 203 | + execCouncilTestingGroupId, |
| 204 | + officersGroupId, |
| 205 | + officersGroupTestingId, |
| 206 | + ]; |
| 207 | + if ( |
| 208 | + paidMemberRequiredGroups.includes(group) && |
| 209 | + action === EntraGroupActions.ADD |
| 210 | + ) { |
197 | 211 | const netId = email.split("@")[0]; |
198 | | - const response = await fetch(`https://membership.acm.illinois.edu/api/v1/checkMembership?netId=${netId}`); |
199 | | - const membershipStatus = await response.json() as { netId: string, isPaidMember: boolean }; |
200 | | - if (!membershipStatus['isPaidMember']) { |
| 212 | + const response = await fetch( |
| 213 | + `https://membership.acm.illinois.edu/api/v1/checkMembership?netId=${netId}`, |
| 214 | + ); |
| 215 | + const membershipStatus = (await response.json()) as { |
| 216 | + netId: string; |
| 217 | + isPaidMember: boolean; |
| 218 | + }; |
| 219 | + if (!membershipStatus["isPaidMember"]) { |
201 | 220 | throw new EntraGroupError({ |
202 | 221 | message: `${netId} is not a paid member. This group requires that all members are paid members.`, |
203 | | - group |
204 | | - }) |
| 222 | + group, |
| 223 | + }); |
205 | 224 | } |
206 | 225 | } |
207 | 226 | try { |
@@ -233,7 +252,10 @@ export async function modifyGroup( |
233 | 252 | const errorData = (await response.json()) as { |
234 | 253 | error?: { message?: string }; |
235 | 254 | }; |
236 | | - if (errorData?.error?.message === "One or more added object references already exist for the following modified properties: 'members'.") { |
| 255 | + if ( |
| 256 | + errorData?.error?.message === |
| 257 | + "One or more added object references already exist for the following modified properties: 'members'." |
| 258 | + ) { |
237 | 259 | return true; |
238 | 260 | } |
239 | 261 | throw new EntraGroupError({ |
|
0 commit comments