Skip to content

Commit 5854c9c

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 e80cb9a commit 5854c9c

24 files changed

Lines changed: 659 additions & 4 deletions

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5555
- `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.
5656
- `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.
5757
- `PATCH /applicationFormFields/:applicationFormFieldId` now returns `403` (instead of `401`) when an authenticated user lacks edit permission on the field's application form.
58+
### Changed
59+
60+
- `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.
5861

5962
## 0.38.0 2026-06-12
6063

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
@@ -497,6 +497,12 @@ describe('/funders', () => {
497497
const grants = await loadPermissionGrantBundle(
498498
db,
499499
getAuthContext(systemUser, true),
500+
undefined,
501+
undefined,
502+
undefined,
503+
undefined,
504+
undefined,
505+
undefined,
500506
NO_LIMIT,
501507
NO_OFFSET,
502508
);
@@ -526,6 +532,12 @@ describe('/funders', () => {
526532
const before = await loadPermissionGrantBundle(
527533
db,
528534
systemUserAuthContext,
535+
undefined,
536+
undefined,
537+
undefined,
538+
undefined,
539+
undefined,
540+
undefined,
529541
NO_LIMIT,
530542
NO_OFFSET,
531543
);
@@ -538,6 +550,12 @@ describe('/funders', () => {
538550
const after = await loadPermissionGrantBundle(
539551
db,
540552
systemUserAuthContext,
553+
undefined,
554+
undefined,
555+
undefined,
556+
undefined,
557+
undefined,
558+
undefined,
541559
NO_LIMIT,
542560
NO_OFFSET,
543561
);

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)