from __future__ import annotations from fastapi import APIRouter, Body from typing import Any from app.api.v1.endpoints.platform import ok, fail from app.db.platform_store import get_platform_store router = APIRouter(prefix="/resources", tags=["resource"]) @router.get("/{resource_type}/{resource_id}/acl") def get_acl(resource_type: str, resource_id: str) -> dict[str, Any]: return ok(get_platform_store().get_acl(resource_type, resource_id)) @router.put("/{resource_type}/{resource_id}/acl") def set_acl( resource_type: str, resource_id: str, payload: dict[str, Any] = Body(...) ) -> dict[str, Any]: return ok( get_platform_store().set_acl( resource_type, resource_id, payload.get("entries", []) ) )