Fix scoped access checks
This commit is contained in:
parent
d90a8fd560
commit
e0efb65efb
7 changed files with 84 additions and 19 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { authenticateApiRequest } from '@/lib/api-auth'
|
||||
import { prisma } from '@/lib/prisma'
|
||||
import { productAccessFilter } from '@/lib/product-access'
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const auth = await authenticateApiRequest(request)
|
||||
|
|
@ -8,7 +9,7 @@ export async function GET(request: Request) {
|
|||
}
|
||||
|
||||
const products = await prisma.product.findMany({
|
||||
where: { user_id: auth.userId, archived: false },
|
||||
where: { archived: false, ...productAccessFilter(auth.userId) },
|
||||
orderBy: { created_at: 'desc' },
|
||||
select: { id: true, name: true, repo_url: true },
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue