feat(api): per-map edit permissions + protected maps + attribution (#4) - #360
Open
Aduersarius wants to merge 1 commit into
Open
feat(api): per-map edit permissions + protected maps + attribution (#4)#360Aduersarius wants to merge 1 commit into
Aduersarius wants to merge 1 commit into
Conversation
…bution (Bitcoindefi#4) Extend GAME_DATA_ADMIN_* to map mutations with collaborator grants in game_map_permissions, block capital maps unless x-protected-map-override, and append who/what/when to game_map_mutation_log on every write.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #4 — Etapa 0 permissions and attribution for map editing.
What landed
requireMapEditSession: sameGAME_DATA_ADMIN_PROXY_TOKENgate; superadmin via email/account; collaborators viagame_map_permissions(map_num or0= all non-protected).{1, 34, 59, 150}: rejected for everyone unless superadmin sendsx-protected-map-override: true.game_map_mutation_logrecords who/what/when on paint, clear, entities, publish, discard, revert, grant/revoke (complementsupdated_by_account_idon row writes).GAME_DATA_ADMIN_*inapi/.env.example.npx tsx --test src/tests/mapEditPermissions.test.ts→ 6/6 covering all four acceptance cases as pure decision logic.Differentiation vs open PRs
isSuperAdmin: true— collaborators never work; no DB grants table; contaminated with graceful-shutdown unrelated filesservices/map-permissions.tswith fictionalassignedMaps; not wired to real admin/session or map routesThis PR keeps permission decision pure (
mapEditPermissions.ts), persists grants + audit in schema, and wires every map mutation route consistently via one header.Test plan
cd api && npx tsx --test src/tests/mapEditPermissions.test.ts(6/6)api/schema.sql(game_map_permissions,game_map_mutation_log)PUT .../maps/50/tiles→ 403x-protected-map-override: true→ okgame_map_mutation_log