(policy: string)
| 508 | * essential-traffic-only mode is active and the cache is unavailable. |
| 509 | */ |
| 510 | export function isPolicyAllowed(policy: string): boolean { |
| 511 | const restrictions = getRestrictionsFromCache() |
| 512 | if (!restrictions) { |
| 513 | if ( |
| 514 | isEssentialTrafficOnly() && |
| 515 | ESSENTIAL_TRAFFIC_DENY_ON_MISS.has(policy) |
| 516 | ) { |
| 517 | return false |
| 518 | } |
| 519 | return true // fail open |
| 520 | } |
| 521 | const restriction = restrictions[policy] |
| 522 | if (!restriction) { |
| 523 | return true // unknown policy = allowed |
| 524 | } |
| 525 | return restriction.allowed |
| 526 | } |
| 527 | |
| 528 | /** |
| 529 | * Get restrictions synchronously from session cache or file |
no test coverage detected