MCPcopy Index your code
hub / github.com/codeaashu/claude-code / hasClaudeAiBillingAccess

Function hasClaudeAiBillingAccess

src/utils/billing.ts:53–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51}
52
53export function hasClaudeAiBillingAccess(): boolean {
54 // Check for mock billing access first (for /mock-limits testing)
55 if (mockBillingAccessOverride !== null) {
56 return mockBillingAccessOverride
57 }
58
59 if (!isClaudeAISubscriber()) {
60 return false
61 }
62
63 const subscriptionType = getSubscriptionType()
64
65 // Consumer plans (Max/Pro) - individual users always have billing access
66 if (subscriptionType === 'max' || subscriptionType === 'pro') {
67 return true
68 }
69
70 // Team/Enterprise - check for admin or billing roles
71 const config = getGlobalConfig()
72 const orgRole = config.oauthAccount?.organizationRole
73
74 return (
75 !!orgRole &&
76 ['admin', 'billing', 'owner', 'primary_owner'].includes(orgRole)
77 )
78}
79

Callers 5

RateLimitMessageFunction · 0.85
RateLimitOptionsMenuFunction · 0.85
runExtraUsageFunction · 0.85
getRateLimitMessageFunction · 0.85

Calls 3

getSubscriptionTypeFunction · 0.85
getGlobalConfigFunction · 0.85
isClaudeAISubscriberFunction · 0.70

Tested by

no test coverage detected