mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-01-31 15:37:09 +01:00
34 lines
693 B
TypeScript
34 lines
693 B
TypeScript
import authManager from "~/server/internal/auth";
|
|
import prisma from "../internal/db/database";
|
|
import { APITokenMode } from "~/prisma/client/enums";
|
|
import type { UserACL } from "../internal/acls";
|
|
|
|
export const CLIENT_WEBTOKEN_ACLS: UserACL = [
|
|
"read",
|
|
"store:read",
|
|
"object:read",
|
|
"settings:read",
|
|
|
|
"collections:read",
|
|
"collections:new",
|
|
"collections:add",
|
|
"collections:remove",
|
|
"collections:delete",
|
|
|
|
"library:add",
|
|
"library:remove",
|
|
];
|
|
|
|
export default defineNitroPlugin(async () => {
|
|
await authManager.init();
|
|
|
|
await prisma.aPIToken.updateMany({
|
|
where: {
|
|
mode: APITokenMode.Client,
|
|
},
|
|
data: {
|
|
acls: CLIENT_WEBTOKEN_ACLS,
|
|
},
|
|
});
|
|
});
|