Skip to content

Commit

Permalink
Enhance fundraising access control by adding dancerRelationsCommittee…
Browse files Browse the repository at this point in the history
… to relevant rules
  • Loading branch information
jthoward64 committed Dec 3, 2024
1 parent 25a7cf5 commit 6c32a3a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/common/lib/api/params/fundraisingAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const fundraisingAccess: AccessControlParam<FundraisingAssignmentNode> =
authRules: [
{
minCommitteeRole: CommitteeRole.Coordinator,
committeeIdentifiers: [CommitteeIdentifier.fundraisingCommittee],
committeeIdentifiers: [CommitteeIdentifier.fundraisingCommittee, CommitteeIdentifier.dancerRelationsCommittee],
},
],
};
25 changes: 13 additions & 12 deletions packages/server/src/resolvers/TeamResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,7 @@ export class TeamResolver implements CrudResolver<TeamNode, "team"> {
) {}

@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(
Expand Down Expand Up @@ -162,6 +151,10 @@ export class TeamResolver implements CrudResolver<TeamNode, "team"> {
committeeIdentifier: CommitteeIdentifier.dancerRelationsCommittee,
minCommitteeRole: CommitteeRole.Coordinator,
},
{
committeeIdentifier: CommitteeIdentifier.fundraisingCommittee,
minCommitteeRole: CommitteeRole.Coordinator,
},
],
}
)
Expand Down Expand Up @@ -192,6 +185,10 @@ export class TeamResolver implements CrudResolver<TeamNode, "team"> {
committeeIdentifier: CommitteeIdentifier.dancerRelationsCommittee,
minCommitteeRole: CommitteeRole.Coordinator,
},
{
committeeIdentifier: CommitteeIdentifier.fundraisingCommittee,
minCommitteeRole: CommitteeRole.Coordinator,
},
],
}
)
Expand Down Expand Up @@ -228,6 +225,10 @@ export class TeamResolver implements CrudResolver<TeamNode, "team"> {
committeeIdentifier: CommitteeIdentifier.dancerRelationsCommittee,
minCommitteeRole: CommitteeRole.Chair,
},
{
committeeIdentifier: CommitteeIdentifier.fundraisingCommittee,
minCommitteeRole: CommitteeRole.Chair,
},
],
}
)
Expand Down
5 changes: 4 additions & 1 deletion packages/server/src/resolvers/accessParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export const globalFundraisingAccessParam: AccessControlParam<unknown> = {
authRules: [
{
minCommitteeRole: CommitteeRole.Coordinator,
committeeIdentifiers: [CommitteeIdentifier.fundraisingCommittee],
committeeIdentifiers: [
CommitteeIdentifier.fundraisingCommittee,
CommitteeIdentifier.dancerRelationsCommittee,
],
},
],
};

0 comments on commit 6c32a3a

Please sign in to comment.