From 6c32a3a58c03e8160604e3a30faa4e77459f467f Mon Sep 17 00:00:00 2001 From: Joshua Tag Howard Date: Tue, 3 Dec 2024 00:26:59 +0000 Subject: [PATCH] Enhance fundraising access control by adding dancerRelationsCommittee to relevant rules --- .../lib/api/params/fundraisingAccess.ts | 2 +- packages/server/src/resolvers/TeamResolver.ts | 25 ++++++++++--------- packages/server/src/resolvers/accessParams.ts | 5 +++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/packages/common/lib/api/params/fundraisingAccess.ts b/packages/common/lib/api/params/fundraisingAccess.ts index 175e2c106..dc79b60d7 100644 --- a/packages/common/lib/api/params/fundraisingAccess.ts +++ b/packages/common/lib/api/params/fundraisingAccess.ts @@ -23,7 +23,7 @@ export const fundraisingAccess: AccessControlParam = authRules: [ { minCommitteeRole: CommitteeRole.Coordinator, - committeeIdentifiers: [CommitteeIdentifier.fundraisingCommittee], + committeeIdentifiers: [CommitteeIdentifier.fundraisingCommittee, CommitteeIdentifier.dancerRelationsCommittee], }, ], }; diff --git a/packages/server/src/resolvers/TeamResolver.ts b/packages/server/src/resolvers/TeamResolver.ts index c3fe96e65..c55f14a74 100644 --- a/packages/server/src/resolvers/TeamResolver.ts +++ b/packages/server/src/resolvers/TeamResolver.ts @@ -72,18 +72,7 @@ export class TeamResolver implements CrudResolver { ) {} @AccessControlAuthorized({ - argumentMatch: [ - { - extractor: ({ teamMemberships }) => - teamMemberships - .filter( - ({ position }) => position === MembershipPositionType.Captain - ) - .map(({ teamId }) => teamId), - // TODO: Figure out if this needs to be "uuid" or "id" - argument: "id", - }, - ], + accessLevel: AccessLevel.Public, }) @Query(() => TeamNode, { name: "team" }) async team( @@ -162,6 +151,10 @@ export class TeamResolver implements CrudResolver { committeeIdentifier: CommitteeIdentifier.dancerRelationsCommittee, minCommitteeRole: CommitteeRole.Coordinator, }, + { + committeeIdentifier: CommitteeIdentifier.fundraisingCommittee, + minCommitteeRole: CommitteeRole.Coordinator, + }, ], } ) @@ -192,6 +185,10 @@ export class TeamResolver implements CrudResolver { committeeIdentifier: CommitteeIdentifier.dancerRelationsCommittee, minCommitteeRole: CommitteeRole.Coordinator, }, + { + committeeIdentifier: CommitteeIdentifier.fundraisingCommittee, + minCommitteeRole: CommitteeRole.Coordinator, + }, ], } ) @@ -228,6 +225,10 @@ export class TeamResolver implements CrudResolver { committeeIdentifier: CommitteeIdentifier.dancerRelationsCommittee, minCommitteeRole: CommitteeRole.Chair, }, + { + committeeIdentifier: CommitteeIdentifier.fundraisingCommittee, + minCommitteeRole: CommitteeRole.Chair, + }, ], } ) diff --git a/packages/server/src/resolvers/accessParams.ts b/packages/server/src/resolvers/accessParams.ts index 497ea98af..aaf3d162e 100644 --- a/packages/server/src/resolvers/accessParams.ts +++ b/packages/server/src/resolvers/accessParams.ts @@ -11,7 +11,10 @@ export const globalFundraisingAccessParam: AccessControlParam = { authRules: [ { minCommitteeRole: CommitteeRole.Coordinator, - committeeIdentifiers: [CommitteeIdentifier.fundraisingCommittee], + committeeIdentifiers: [ + CommitteeIdentifier.fundraisingCommittee, + CommitteeIdentifier.dancerRelationsCommittee, + ], }, ], };