MC/website/docs/great-migration.md

145 lines
11 KiB
Markdown

# Alpha 1.0.0.7 — The Great Migration
## Batch 1: central directory and contextual account views
The existing CP account tool mixes staff access, user memberships and recognition.
The new directory separates Users and Staff while keeping one underlying account.
Review URL after this batch is deployed:
`https://cp.dunerealms.com/?migration=1#bureau/user-management`.
The regular URL continues to use the existing editor during this incremental batch.
Included:
- Central organisation vocabulary: two departments, nine branches, contextual roles.
- Additive `org_assignments` storage, indexed by account and scope.
- Read-only `/api/admin/citizens`, `/catalogue`, and `/:accountId` endpoints.
- Server-side whole-directory search by account name, Minecraft name/UUID or ID,
contextual staff filtering and 25-record pagination with an extra sentinel row.
- Users, Manage User and Manage Staff views. User responses exclude staff scopes
and staff provenance. Staff views retain imported source identity for review.
- Existing account administration and all live permissions remain unchanged.
Not claimed complete in batch 1: assignment writes, permission activation/projection,
native integration migration, the recognition editor and the audit timeline. Existing memberships have not
yet been imported into `org_assignments`; an empty new-model list is not a claim
that the citizen has no memberships in existing systems.
Validation: contextual disclosure, authentication and authorisation denials,
SQL parameterisation/literal wildcard search, filter validation, schema no-grant
behaviour, and pagination are covered by executable tests. No financial actions,
player identities or live staff appointments are changed by this batch.
## Migration rules
Reuse the existing API, database adapter and integration adapters. Do not rewrite
osTicket, MyBB or LuckPerms. Human ranks lose native user/group/permission editing
capabilities; those writes originate centrally. Do not remove or lock the native
modules. Dev retains existing service access, separate from the human organigram.
Official bank account management is reserved for the Big Four and Department Heads.
Existing system-account restrictions remain. Staff ranks contain explicit job
nodes, without wildcard or OP grants. Assignments may overlap and expire; their
derived rights/seals must follow their lifecycle. Earned honours remain intact.
## Subsequent batches
1. Contextual assignment editor, audited changes and central policy matrix.
2. Map current rights to the approved hierarchy and existing native adapters;
synchronisation/revocation, visible failures and retry.
3. Recognition, personal and function seals, signatures across connected systems.
4. Public staff organigram + ordered bio cards; separate Crysknife Order gallery.
5. Full public profile template preserving current features; verified Bedrock-name
normalisation; Picard memorial restyle/link and Big-Four-only Deceased workflow.
6. Access/lifecycle/privacy verification, release and combined .6/.7 announcement.
Do not change the public version banner or publish release news before .7 is done.
## Personal and function seal batch
The current organisation catalogue supplies eleven department/branch seals and
eleven new personal seals, alongside three existing Staff personal seals. Big
Four artwork carries the fixed CEO/CTO/COO/CCO title; other personal seals say
Staff. The official account has no personal seal. The public organigram, staff
cards, profiles and managed native signatures follow current appointments;
earned service awards retain their existing eligibility and artwork.
Raster originals, prompts and catalogue live in artwork/seals/great-migration.
package-migration-seals.py creates alpha-preserving 150/300px delivery images.
install-migration-seals.py plans by default; --apply installs custom adapters,
merges the historical manifest and copies native delivery images. It does not
alter native application core files. Run native seal/profile reconciliation
after deployment. The native avatar allowlist now accepts the central face
endpoint while retaining its fixed origin and UUID-only path restriction.
## Recognition and remembrance
The directory recognition tab shows current seals and earned awards, with
manual grant/revoke controls backed by the existing entitlement ledger. Automatic
and purchased recognition stays managed at its source; self-awards are blocked.
Native signatures read active entitlements and manual changes queue the existing
synchronisation flow. Support cards use the new branch artwork.
The Account tab exposes remembrance status only to pinned Big Four principals
(and the exempt Dev operator), including the verified owner alias. Changing it
requires an exact username confirmation, reason and current version. Status,
memorial creation and audit commit together. A repeated notification creates no
duplicate page. Corrections hide the page while retaining history. This metadata
does not change login access, linked identity, ranks or bank records. Existing
community tribute content is preserved; no real-life death status is inferred.
Citizen details read earned tiers, house/office/path/Order ranks and current clan
membership from the existing registers. They do not expose staff functions in the
User view or copy membership authority into the staff register. Legacy User/VIP
permission lists cannot retain staff powers through cp.* aliases, native forum
administration, job ticket nodes, item issuance or lobby administration.
## Batch 2: audited assignment editor and policy preparation
Staff assignments can be recorded and revoked within the manager's scope. One
lead per branch/department is enforced under a shared scope lock. A scope version
prevents stale forms from overwriting another manager's work. Automatic records
must be changed at their source. Service accounts stay outside human appointments.
The permission matrix at `?migration=1#bureau/permissions` maps registered existing
nodes to each function. It rejects wildcard/OP/native-editor nodes and official
bank management on ordinary branch roles. Policy writes and assignments share
atomic audit and version checks. These are preparatory records: they do not yet
replace live roles. No native backend code is rewritten.
An explicit operator-run `scripts/bootstrap-organisation-control.mjs --apply`
pins the existing Big Four and Dev service by account ID for management authority.
It is idempotent, checks the established Owner/Dev identities, refuses conflicting
existing principals and does not run at application startup. Its audit clearly
states that it does not activate live permission projection.
## Additional Owner-approved bank work
After the current management batch, add a staff Client Management context reusing
Accounts & Payments components without generic Wire Transfers.
Add immediate Service Compensation from Payment Control, linked to the original
posted payment, with reason, consent, actual actor and a distinct purple type
badge in staff/customer histories and statements. Recover funds from the original
recipient when possible; otherwise the bank bears the cost. Never erase the
original payment or compensate its value more than once across retries/partials.
The shared budget is the available balance of a dedicated Compensation Reserve.
A monthly standing instruction funds it from Website Bank Treasury, initially
25,000 DM; unspent funds roll forward. Big Four and the bank CEO may change that
standing instruction and transfer reserve funds in/out through Treasury Accounts.
No extra Officer cap/counter, CEO override system, support ticket, approval flow,
or four-hour compensation queue. Reuse existing posting/audit infrastructure.
Cash conversion is reserved for the future in-game GUI + central API in both
directions. No cash web page, redeem code flow or game changes in this batch.
Effective-access preview: GET /api/admin/organisation/effective?userId=UUID requires web.ranks.manage and computes explicit new-model grants with provenance. Branch Leads inherit their own Officer policy. Missing policies and blocked unsafe grants are reported. Staff Directory has an Access preview tab; User context does not. Payroll requires a pinned Big Four control principal (Dev service exception), never an Executive title alone. No live rank mutation or native projection is activated by this endpoint.
Default policies now enumerate 22 function mappings (nine branches with Officer/Lead, two Department Heads, Owner/Executive). Native permission editors are excluded for humans; official bank management remains departmental/executive, payroll requires pinned control identity. bootstrap-organisation-policies.mjs defaults to a plan; explicit --apply --actor=UUID requires an active control principal, retains existing policies, versions each scope and audits inserts atomically. It stores preparation data only, with no legacy rank replacement, user appointments or native group projection.
Runtime integration: ORGANISATION_ACCESS_ENABLED=true opts the central database adapter into fresh, read-snapshot organisation access. The default remains disabled. Enabled accessFor replaces legacy staff/owner bypass with new explicit policies, preserves ordinary/VIP/Order membership, and keeps only the pinned exempt Dev service on its existing access path. Invalid policy data fails closed, never falls back to old admin grants. This switch must not be enabled before control baseline, assignments, policy coverage and native projections are reconciled. This source batch does not enable it in production. Public session exports the account's own active functions.
Native bridge integration: activated game sync sends stable permission-set groups through the existing revision-confirmed /permissions/teams bridge. Explicit canonical game nodes plus retained citizen gameplay perks are combined; wildcard/OP/LuckPerms editor grants and service identities are excluded. Duplicate verified UUIDs abort the projection. Unactivated game sync stays on its existing path. Native agent sync reuses the installed osTicket adapter and maps ticket department tags; active human payloads omit native administration flags while retaining business department access. Dev service payload is unchanged. No game server or native application code is rewritten or deployed by this source batch.
Approved appointments and public staff page: the migration plan resolves 14 existing people into 26 current functions, validates the existing Owner identity and rejects service accounts or conflicting leaders. It defaults to dry-run; explicit application is audited and idempotent. The redesigned staff.html uses the public publication allowlist, one biography card per person, an organigram with explicit vacancies and a separate Crysknife Order gallery. Canonical profile links are retained for Bedrock display names. Active function changes now atomically queue the existing native synchronization outbox; the public process starts its retry worker only in active mode. Forum SSO filters native privilege administration for central human identities while retaining the Dev service path. Existing native products are reused.