This commit is contained in:
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user