Secure view read

This commit is contained in:
Adria Navarro 2023-09-01 12:19:16 +02:00
parent 8c801f2bbe
commit a541bde7e1
1 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import Router from "@koa/router" import Router from "@koa/router"
import * as viewController from "../controllers/view" import * as viewController from "../controllers/view"
import * as rowController from "../controllers/row" import * as rowController from "../controllers/row"
import authorized from "../../middleware/authorized" import authorized, { authorizedResource } from "../../middleware/authorized"
import { paramResource } from "../../middleware/resourceId" import { paramResource } from "../../middleware/resourceId"
import { permissions } from "@budibase/backend-core" import { permissions } from "@budibase/backend-core"
@ -10,10 +10,10 @@ const router: Router = new Router()
router router
.get( .get(
"/api/v2/views/:viewId", "/api/v2/views/:viewId",
paramResource("viewId"), authorizedResource(
authorized( permissions.PermissionType.VIEW,
permissions.PermissionType.TABLE, permissions.PermissionLevel.READ,
permissions.PermissionLevel.READ "viewId"
), ),
viewController.v2.get viewController.v2.get
) )