Add AFK account and session overview (Refs #151)
CI / checks (push) Successful in 7m19s

This commit is contained in:
2026-10-17 17:52:03 -04:00
parent d723f23d67
commit 59f88ac33d
22 changed files with 2035 additions and 6 deletions
+17
View File
@@ -102,6 +102,8 @@ describe('management route permissions', () => {
'/metrics',
'/bank',
'/api/bank',
'/afk',
'/api/afk',
'/api/matches',
'/matches/[id]',
'/leaderboard/players/[game]/[guid]',
@@ -128,6 +130,21 @@ describe('management route permissions', () => {
expect(allows('viewer', route, 'HEAD')).toBe(true);
});
it('keeps AFK reporting separate from game credentials and administrator corrections', () => {
for (const route of ['/afk', '/api/afk']) {
for (const method of ['GET', 'HEAD']) {
expect(routePermission(route, method)).toBe('viewer');
for (const role of roles) expect(allows(role, route, method)).toBe(true);
}
}
expect(routePermission('/api/afk/[action]', 'POST')).toBe('machine');
for (const role of roles) {
expect(allows(role, '/api/afk/[action]', 'POST')).toBe(false);
expect(allows(role, '/api/afk/corrections', 'POST')).toBe(role === 'admin');
}
expect(routePermission('/api/afk/corrections', 'POST')).toBe('admin');
});
it.each([
['/api/servers', 'POST'],
['/api/servers/[name]', 'DELETE'],