fix(player): open the player self-service surface to staff #94
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/staff-player-self-service"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A staff account (admin/editor/moderator) that also has linked game characters got a 403 on its own player game-data (e.g.
GET /player/shard/accounts), because the whole/player/*group ranrequireRole('player'). On the Android client this hid the "My characters" menu and greyed the personal notification streams for staff, even with linked characters.This contradicts the original design — staff are a superset of players (all player abilities + staff tools on top), which is why the same self-scoped handlers are already mirrored under
/admin/shard/*.Fix
player.routes.js:requireRole('player')→requireAuthonly. Every handler is already self-scoped to the caller byreq.user.id(with the pre-existingisAdminbypass still letting a genuine admin read any character), so this only ever widens access to the caller's own data.403 "Player role required"swagger descriptions and regeneratedswagger-output.json.test/playerRouteAccess.test.jsmounts the router and asserts player/admin/editor/moderator all reach the handler, anon still 401s, and a disabled account still 403s.Tests: 420 pass (6 new).
Coordinated change
RunicGateway/docs→docs/staff-player-self-serviceRunicGateway/Android-app→fix/staff-player-menu(reveals the player menu items for staff; relies on this 200)🤖 Generated with Claude Code
AI-assisted: authored with Claude Code (Opus 4.8).
Staff are a superset of players — every player ability plus their staff tools on top — but the /player/* group ran requireRole('player'), so a signed-in admin/editor/moderator got 403 on their own linked game accounts (e.g. GET /player/shard/accounts). On the Android client this hid "My characters" and greyed the personal notification streams for staff accounts, even when they had linked characters. Drop the role gate: the group is now requireAuth-only. Every handler is already self-scoped to the caller by req.user.id (with the pre-existing isAdmin bypass still letting a genuine admin read any character), so this only ever widens access to the caller's OWN data. Staff also reach the identical self-scoped handlers under /admin/shard/* (same controller). - player.routes.js: requireRole('player') -> requireAuth; corrected the five stale "Player role required" 403 descriptions and regenerated swagger-output.json. - New test/playerRouteAccess.test.js mounts the router and asserts player/admin/editor/moderator all reach the handler, anon still 401s, and a disabled account still 403s. Suite: 420 pass. Co-Authored-By: Claude <noreply@anthropic.com>