---
title: Determine Glimpse diagnostic access
summary: Decide whether the current request should be granted access to the Glimpse diagnostics panel.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-09-17
library: SAIF.Framework.Web.Mvc
reference_type: package
operation_id: OP-24
trigger: Caller checking whether the Glimpse diagnostics panel should be shown*
---

# Determine Glimpse diagnostic access

Decide whether the current request should be granted access to the Glimpse diagnostics panel. Trigger: Caller checking whether the Glimpse diagnostics panel should be shown*.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-24 |
| **Trigger** | Caller checking whether the Glimpse diagnostics panel should be shown* |
| **Inputs** | `HttpContextBase` — `Server.MachineName` and `User` |
| **Outputs** | `bool` |
| **Primary components** | `SAIF.Web.HttpContextExtensions.HasGlimpseAccess(HttpContextBase)` |
| **Entry point** | `src/Web/Extensions/HttpContextExtensions.cs` |

## Steps

1. Set `env = "Test"` unless the lower-cased machine name contains `"prod"`; production yields an empty environment token ([BR-55](../business-rules.md#br-55-non-production-servers-use-the-test-glimpse-resource-variant)).
2. Return `context.User != null && !context.User.IsInRole("GlimpseUser{env}Resource")`, i.e. `GlimpseUserTestResource` off production and `GlimpseUserResource` on production ([BR-56](../business-rules.md#br-56-glimpse-access-requires-an-authenticated-user-and-a-negated-role-test)).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Caller checks Glimpse access])
	Env[Determine env from MachineName]
	User{context.User non-null?}
	Deny([Return false])
	Role{User NOT in GlimpseUser env Resource?}
	Allow([Return true])
	DenyRole([Return false])
	Start --> Env
	Env --> User
	User -->|No| Deny
	User -->|Yes| Role
	Role -->|Yes| Allow
	Role -->|No| DenyRole
```

## Failure and edge-case behavior

- The role test is negated, so an authenticated user who is NOT in the Glimpse role receives `true`. Whether this is intended or a defect cannot be determined from this repository.**

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.


## Sources
- `src/Web/Extensions/HttpContextExtensions.cs`
