Fix scoped access checks
This commit is contained in:
parent
d90a8fd560
commit
e0efb65efb
7 changed files with 84 additions and 19 deletions
|
|
@ -57,10 +57,16 @@ describe('Security: cross-user access', () => {
|
|||
|
||||
expect(response.status).toBe(200)
|
||||
expect(data).toHaveLength(1)
|
||||
// Verify the query filtered by user_id
|
||||
// Verify the query includes owned products and products shared through membership.
|
||||
expect(mockPrisma.product.findMany).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
where: expect.objectContaining({ user_id: 'user-1' }),
|
||||
where: expect.objectContaining({
|
||||
archived: false,
|
||||
OR: expect.arrayContaining([
|
||||
{ user_id: 'user-1' },
|
||||
{ members: { some: { user_id: 'user-1' } } },
|
||||
]),
|
||||
}),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue