mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-15 09:11:21 +10:00
feat: add ability to review and revoke clients
This commit is contained in:
15
server/api/v1/user/client/index.get.ts
Normal file
15
server/api/v1/user/client/index.get.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const userId = await aclManager.getUserIdACL(h3, ["clients:read"]);
|
||||
if (!userId) throw createError({ statusCode: 403 });
|
||||
|
||||
const clients = await prisma.client.findMany({
|
||||
where: {
|
||||
userId,
|
||||
},
|
||||
});
|
||||
|
||||
return clients;
|
||||
});
|
||||
Reference in New Issue
Block a user