Skip to content

Commit 93db778

Browse files
committed
Require builder access for group listing
1 parent 124e5df commit 93db778

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

packages/worker/src/api/routes/global/groups.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ router
3939
)
4040
.get(
4141
"/api/global/groups",
42+
auth.builderOrAdmin,
4243
proMiddleware.feature.requireFeature(Feature.USER_GROUPS),
4344
controller.fetch
4445
)

packages/worker/src/api/routes/global/tests/groups.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,12 @@ describe("/api/global/groups", () => {
377377
})
378378
})
379379

380+
it("fetch should return 200", async () => {
381+
await config.withUser(builder, async () => {
382+
await config.api.groups.fetch()
383+
})
384+
})
385+
380386
it("update should return forbidden", async () => {
381387
await config.withUser(builder, async () => {
382388
await config.api.groups.updateGroupUsers(
@@ -391,6 +397,19 @@ describe("/api/global/groups", () => {
391397
})
392398
})
393399

400+
describe("with basic role", () => {
401+
it("fetch should return forbidden", async () => {
402+
const user = await config.createUser({
403+
builder: { global: false },
404+
admin: { global: false },
405+
})
406+
407+
await config.withUser(user, async () => {
408+
await config.api.groups.fetch({ expect: 403 })
409+
})
410+
})
411+
})
412+
394413
describe("bulk add users via CSV", () => {
395414
let groupId: string
396415
let existingUsers: { _id: string; email: string }[] = []

0 commit comments

Comments
 (0)