Files
learning-platform/app/pb_migrations/1779567108_updated_topics.js
RaymondVerhoef 8684ffa35b feat: add new page and migration scripts for access rules and collections
- Introduced new page component for library topics with type checks.
- Added migration scripts to update access rules for various collections including badges, curriculum versions, and themes.
- Implemented PocketBase integration for managing collection access rules dynamically.
- Ensured proper type validation for page props and metadata generation functions.
2026-05-23 22:26:40 +02:00

25 lines
785 B
JavaScript

/// <reference path="../pb_data/types.d.ts" />
migrate((db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("1ixwljuo2xqxcqj")
collection.listRule = "@request.auth.id != \"\""
collection.viewRule = "@request.auth.id != \"\""
collection.createRule = "@request.auth.role = \"admin\""
collection.updateRule = "@request.auth.role = \"admin\""
collection.deleteRule = "@request.auth.role = \"admin\""
return dao.saveCollection(collection)
}, (db) => {
const dao = new Dao(db)
const collection = dao.findCollectionByNameOrId("1ixwljuo2xqxcqj")
collection.listRule = null
collection.viewRule = null
collection.createRule = null
collection.updateRule = null
collection.deleteRule = null
return dao.saveCollection(collection)
})