Skip to content

Load menu and context value

Pages that derive from BolMenuModel display the BOL menu and the context textbox. Before the handler executes, this operation loads the menu for the current user and applies any submitted context value.

Field Value
Operation ID OP-08
Trigger Handler execution on a BolMenuModel page
Inputs Session menu, current user id, submitted ContextValue
Outputs MenuData, updated web context
Primary components BolMenuModel.OnPageHandlerExecuting, MenuService.GetMenu
Entry point src/BolMiddleware/Models/BolMenuModel.cs

Steps

  1. Read the menu from the session; if it is absent, call MenuService.GetMenu with the current user id and save the result to the session (BR-BOLMIDDLEWARE-007).
  2. If the BOL Menu API fails: the service returns null and MenuData stays the default empty menu.
  3. If a ContextValue was submitted, classify it by length: fewer than seven or exactly nine characters is a policy number, otherwise a claim number (BR-BOLMIDDLEWARE-008).
  4. Store the number in the web context and refresh it for the handler.
  5. The layouts render the context textbox as a visible input when ChangeContextPrivilege is true and as a hidden input otherwise (BR-BOLMIDDLEWARE-019). This is presentation only: step 2 reads the posted contextvalue without checking the flag.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Handler executing]) --> D1{Menu in session?}
    D1 -->|Yes| S1[Use session menu]
    D1 -->|No| S2[Call BOL Menu API and save to session]
    S1 --> D2{ContextValue submitted?}
    S2 --> D2
    D2 -->|No| EndOk([Handler runs])
    D2 -->|Yes| D3{Length under 7 or equal 9?}
    D3 -->|Yes| S3[Store as policy number]
    D3 -->|No| S4[Store as claim number]
    S3 --> EndOk
    S4 --> EndOk

Failure and edge-case behavior

  • A menu cached in the session is not refreshed until the session ends.
  • The length test is the only validation; non-numeric values are accepted.
  • The class carries [IgnoreAntiforgeryToken], so posts to derived pages are not checked for anti-forgery tokens.

Sources

  • src/BolMiddleware/Models/BolMenuModel.cs
  • src/BolMiddleware/Services/Menu/MenuService.cs
  • src/BolMiddleware/Pages/Shared/_PolicyLayout.cshtml