Add API Server (Go/PocketBase), Web App (Go BFF + Vue), Fly App (Flutter/DJI MSDK), Adobe Plugin, and Docker/Docker AIO deployment configs. Design assets and build artifacts are gitignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
966 B
JavaScript
26 lines
966 B
JavaScript
/// <reference path="../pb_data/types.d.ts" />
|
|
|
|
// Extends the `users.role` select field with a top-level `superadmin` value.
|
|
// Final set: superadmin | admin | user. superadmin spans all organizations;
|
|
// admin is scoped to one org; user has no management rights. Missing/empty role
|
|
// is still treated as `user` by the app.
|
|
//
|
|
// Idempotent: no-op if `superadmin` is already an allowed value. Written for
|
|
// PocketBase v0.22+/v0.23.
|
|
migrate(
|
|
(app) => {
|
|
const users = app.findCollectionByNameOrId('users')
|
|
const role = users.fields.getByName('role')
|
|
if (!role || (role.values && role.values.indexOf('superadmin') !== -1)) return
|
|
role.values = ['superadmin'].concat(role.values || [])
|
|
app.save(users)
|
|
},
|
|
(app) => {
|
|
const users = app.findCollectionByNameOrId('users')
|
|
const role = users.fields.getByName('role')
|
|
if (!role) return
|
|
role.values = (role.values || []).filter((v) => v !== 'superadmin')
|
|
app.save(users)
|
|
},
|
|
)
|