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.
This commit is contained in:
24
app/pb_migrations/1779567108_updated_employee_badges.js
Normal file
24
app/pb_migrations/1779567108_updated_employee_badges.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((db) => {
|
||||
const dao = new Dao(db)
|
||||
const collection = dao.findCollectionByNameOrId("52xqp11w4t0y68u")
|
||||
|
||||
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("52xqp11w4t0y68u")
|
||||
|
||||
collection.listRule = null
|
||||
collection.viewRule = null
|
||||
collection.createRule = null
|
||||
collection.updateRule = null
|
||||
collection.deleteRule = null
|
||||
|
||||
return dao.saveCollection(collection)
|
||||
})
|
||||
Reference in New Issue
Block a user