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¶
- Set
env = "Test"unless the lower-cased machine name contains"prod"; production yields an empty environment token (BR-55). - Return
context.User != null && !context.User.IsInRole("GlimpseUser{env}Resource"), i.e.GlimpseUserTestResourceoff production andGlimpseUserResourceon production (BR-56).
Process flow¶
The following diagram visualizes this operation's control flow.
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¶
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