Skip to content

Commit 3d46b04

Browse files
authored
Add account analytics OAuth scope (cloudflare#173)
1 parent 3506ef5 commit 3d46b04

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/auth/scopes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const ALL_SCOPES = {
5454
'logpush:read': 'View Logpush jobs',
5555
'logpush:write': 'Configure Logpush jobs',
5656
'auditlogs:read': 'View audit logs',
57+
'account-analytics.read': 'View account analytics such as RUM and Web Analytics data',
5758
'logs.read': 'View logs',
5859
'logs.write': 'Manage logs',
5960

src/auth/workers-oauth-utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ const RESOURCE_LABELS: Record<string, string> = {
241241
aiaudit: 'AI Audit',
242242
'ai-search': 'AI Search',
243243
auditlogs: 'Audit logs',
244+
'account-analytics': 'Account analytics',
244245
browser: 'Browser Rendering',
245246
cfone: 'Cloudflare One',
246247
connectivity: 'Connectivity',
@@ -349,6 +350,7 @@ const CATEGORY_MAP: Record<string, string> = {
349350
snippets: 'DNS & Zones',
350351
logpush: 'Analytics & Logs',
351352
auditlogs: 'Analytics & Logs',
353+
'account-analytics': 'Analytics & Logs',
352354
logs: 'Analytics & Logs',
353355
lb: 'Networking',
354356
notification: 'Networking',

tests/auth/scopes.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const REGISTERED_SCOPES = [
4949
'logpush:read',
5050
'logpush:write',
5151
'auditlogs:read',
52+
'account-analytics.read',
5253
'logs.read',
5354
'logs.write',
5455
'account-ssl-and-certificates.write',
@@ -166,6 +167,11 @@ describe('scopes', () => {
166167
expect(SCOPE_TEMPLATES['read-only'].scopes).toContain('registrar-domains.read')
167168
expect(SCOPE_TEMPLATES['read-only'].scopes).toContain('logs.read')
168169
expect(SCOPE_TEMPLATES['read-only'].scopes).toContain('ssl-and-certificates.read')
170+
expect(SCOPE_TEMPLATES['read-only'].scopes).toContain('account-analytics.read')
171+
})
172+
173+
it('full-access template should include account analytics access', () => {
174+
expect(SCOPE_TEMPLATES.yolo.scopes).toContain('account-analytics.read')
169175
})
170176

171177
it('full-access template should include derived SSL certificate access', () => {

0 commit comments

Comments
 (0)