feat(authz): Workspace.canInvite and Project.canInvite (#4419)

This commit is contained in:
Chuck Driesler
2025-04-16 09:01:53 +01:00
committed by GitHub
parent e31f4c5a47
commit cebae959ae
10 changed files with 283 additions and 54 deletions
@@ -186,9 +186,7 @@ describe('Workspaces Invites GQL', () => {
}
})
expect(res).to.haveGraphQLErrors(
'Attempting to invite into a non-existant workspace'
)
expect(res).to.haveGraphQLErrors('You do not have access to the workspace')
expect(res.data?.workspaceMutations?.invites?.create).to.not.be.ok
})
@@ -226,7 +224,9 @@ describe('Workspaces Invites GQL', () => {
}
})
expect(res).to.haveGraphQLErrors('You are not authorized')
expect(res).to.haveGraphQLErrors(
'You do not have enough permissions in the workspace to perform this action'
)
expect(res.data?.workspaceMutations?.invites?.create).to.not.be.ok
})
@@ -269,7 +269,9 @@ describe('Workspaces Invites GQL', () => {
}))
})
expect(res).to.haveGraphQLErrors('You are not authorized')
expect(res).to.haveGraphQLErrors(
'You do not have enough permissions in the workspace to perform this action'
)
expect(res.data?.workspaceMutations?.invites?.batchCreate).to.not.be.ok
})
@@ -739,7 +741,9 @@ describe('Workspaces Invites GQL', () => {
}
})
expect(res).to.haveGraphQLErrors('You are not authorized')
expect(res).to.haveGraphQLErrors(
'You do not have enough permissions in the workspace to perform this action'
)
expect(res.data?.workspaceMutations?.invites?.cancel).to.not.be.ok
const invite = await findInviteFactory({ db })({
@@ -1082,7 +1082,9 @@ describe('Workspaces GQL CRUD', () => {
})
expect(deleteRes).to.not.haveGraphQLErrors()
expect(getRes).to.haveGraphQLErrors('Workspace not found')
expect(getRes).to.haveGraphQLErrors(
'You are not authorized to access this resource'
)
})
it('should throw if non-workspace-admin triggers delete', async () => {