fix(security): enforce API authentication rules on collection (#214)

- Add authentication and authorization rules to prevent unauthorized access via REST API endpoints.
This commit is contained in:
Tola Leng
2026-02-27 00:17:45 +07:00
parent 9dbd267a22
commit f2c338ced9
25 changed files with 793 additions and 355 deletions
@@ -0,0 +1,28 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_763794515")
// update collection data
unmarshal({
"createRule": "@request.auth.id != \"\"",
"deleteRule": "@request.auth.id != \"\"",
"listRule": "@request.auth.id != \"\"",
"updateRule": "@request.auth.id != \"\"",
"viewRule": "@request.auth.id != \"\""
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_763794515")
// update collection data
unmarshal({
"createRule": null,
"deleteRule": null,
"listRule": null,
"updateRule": null,
"viewRule": null
}, collection)
return app.save(collection)
})