mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-16 01:31:19 +10:00
feat(acls): refactor & acl descriptions
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import clientHandler from "~/server/internal/clients/handler";
|
||||
import { useCertificateAuthority } from "~/server/plugins/ca";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const body = await readBody(h3);
|
||||
@ -27,14 +28,14 @@ export default defineEventHandler(async (h3) => {
|
||||
statusMessage: "Invalid token",
|
||||
});
|
||||
|
||||
const ca = h3.context.ca;
|
||||
const bundle = await ca.generateClientCertificate(
|
||||
const certificateAuthority = useCertificateAuthority();
|
||||
const bundle = await certificateAuthority.generateClientCertificate(
|
||||
clientId,
|
||||
metadata.data.name
|
||||
);
|
||||
|
||||
const client = await clientHandler.finialiseClient(clientId);
|
||||
await ca.storeClientCertificate(clientId, bundle);
|
||||
await certificateAuthority.storeClientCertificate(clientId, bundle);
|
||||
|
||||
return {
|
||||
private: bundle.priv,
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||
import objectHandler from "~/server/internal/objects";
|
||||
|
||||
export default defineClientEventHandler(async (h3, utils) => {
|
||||
const id = getRouterParam(h3, "id");
|
||||
@ -6,7 +7,7 @@ export default defineClientEventHandler(async (h3, utils) => {
|
||||
|
||||
const user = await utils.fetchUser();
|
||||
|
||||
const object = await h3.context.objects.fetchWithPermissions(id, user.id);
|
||||
const object = await objectHandler.fetchWithPermissions(id, user.id);
|
||||
if (!object)
|
||||
throw createError({ statusCode: 404, statusMessage: "Object not found" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user