Skip to content

Commit 4397cb7

Browse files
committed
Add query parameters for related entities on GET permissions
This adds optional filter query parameters, mirroring the existing `GET /proposals` filtering pattern on Context entity, `changemaker`, `funder`, `dataProvider`, `proposal` and Grantee, `granteeType` and `verb`. This means adding a dataprovider parameters extractor, a granteeType, and a verb extractor method. Issue #2447 Add filtering to permission grant queries
1 parent 4a4496a commit 4397cb7

24 files changed

Lines changed: 664 additions & 9 deletions

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- `PUT /permissionGrants/:permissionGrantId` now returns `403` (instead of `401`) when an authenticated user lacks permission to manage permission grants on the specified context entity, and `404` when that context entity cannot be viewed or does not exist.
2323
- `POST /applicationForms` now returns `403` (instead of `401`) when an authenticated user lacks permission on the associated opportunity, and `404` (instead of `422`) when that opportunity cannot be viewed or does not exist.
2424
- `PATCH /applicationFormFields/:applicationFormFieldId` now returns `403` (instead of `401`) when an authenticated user lacks edit permission on the field's application form.
25+
### Changed
26+
27+
- `GET /permissionGrants` now accepts optional filter query parameters: `changemaker`, `funder`, `dataProvider`, and `proposal` to filter by context entity, and `granteeType` and `verb` to filter by grantee.
2528

2629
## 0.38.0 2026-06-12
2730

src/__tests__/applicationForms.int.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,12 @@ describe('/applicationForms', () => {
822822
const grants = await loadPermissionGrantBundle(
823823
db,
824824
getAuthContext(systemUser, true),
825+
undefined,
826+
undefined,
827+
undefined,
828+
undefined,
829+
undefined,
830+
undefined,
825831
NO_LIMIT,
826832
NO_OFFSET,
827833
);

src/__tests__/bulkUploadTasks.int.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,12 @@ describe('/tasks/bulkUploads', () => {
567567
const grants = await loadPermissionGrantBundle(
568568
db,
569569
getAuthContext(systemUser, true),
570+
undefined,
571+
undefined,
572+
undefined,
573+
undefined,
574+
undefined,
575+
undefined,
570576
NO_LIMIT,
571577
NO_OFFSET,
572578
);

src/__tests__/changemakerFieldValues.int.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ describe('POST /changemakerFieldValues', () => {
121121
const grants = await loadPermissionGrantBundle(
122122
db,
123123
getAuthContext(systemUser, true),
124+
undefined,
125+
undefined,
126+
undefined,
127+
undefined,
128+
undefined,
129+
undefined,
124130
NO_LIMIT,
125131
NO_OFFSET,
126132
);

src/__tests__/changemakers.int.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,12 @@ describe('/changemakers', () => {
11261126
const grants = await loadPermissionGrantBundle(
11271127
db,
11281128
getAuthContext(systemUser, true),
1129+
undefined,
1130+
undefined,
1131+
undefined,
1132+
undefined,
1133+
undefined,
1134+
undefined,
11291135
NO_LIMIT,
11301136
NO_OFFSET,
11311137
);

src/__tests__/dataProviders.int.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ describe('/dataProviders', () => {
203203
const grants = await loadPermissionGrantBundle(
204204
db,
205205
getAuthContext(systemUser, true),
206+
undefined,
207+
undefined,
208+
undefined,
209+
undefined,
210+
undefined,
211+
undefined,
206212
NO_LIMIT,
207213
NO_OFFSET,
208214
);
@@ -230,6 +236,12 @@ describe('/dataProviders', () => {
230236
const before = await loadPermissionGrantBundle(
231237
db,
232238
systemUserAuthContext,
239+
undefined,
240+
undefined,
241+
undefined,
242+
undefined,
243+
undefined,
244+
undefined,
233245
NO_LIMIT,
234246
NO_OFFSET,
235247
);
@@ -242,6 +254,12 @@ describe('/dataProviders', () => {
242254
const after = await loadPermissionGrantBundle(
243255
db,
244256
systemUserAuthContext,
257+
undefined,
258+
undefined,
259+
undefined,
260+
undefined,
261+
undefined,
262+
undefined,
245263
NO_LIMIT,
246264
NO_OFFSET,
247265
);

src/__tests__/funders.int.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,12 @@ describe('/funders', () => {
492492
const grants = await loadPermissionGrantBundle(
493493
db,
494494
getAuthContext(systemUser, true),
495+
undefined,
496+
undefined,
497+
undefined,
498+
undefined,
499+
undefined,
500+
undefined,
495501
NO_LIMIT,
496502
NO_OFFSET,
497503
);
@@ -521,6 +527,12 @@ describe('/funders', () => {
521527
const before = await loadPermissionGrantBundle(
522528
db,
523529
systemUserAuthContext,
530+
undefined,
531+
undefined,
532+
undefined,
533+
undefined,
534+
undefined,
535+
undefined,
524536
NO_LIMIT,
525537
NO_OFFSET,
526538
);
@@ -533,6 +545,12 @@ describe('/funders', () => {
533545
const after = await loadPermissionGrantBundle(
534546
db,
535547
systemUserAuthContext,
548+
undefined,
549+
undefined,
550+
undefined,
551+
undefined,
552+
undefined,
553+
undefined,
536554
NO_LIMIT,
537555
NO_OFFSET,
538556
);

src/__tests__/opportunities.int.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,12 @@ describe('/opportunities', () => {
364364
const grants = await loadPermissionGrantBundle(
365365
db,
366366
getAuthContext(systemUser, true),
367+
undefined,
368+
undefined,
369+
undefined,
370+
undefined,
371+
undefined,
372+
undefined,
367373
NO_LIMIT,
368374
NO_OFFSET,
369375
);

0 commit comments

Comments
 (0)