Load policy header and validate access¶
Pages that derive from BolPolicyModel show the policy header above their content. This operation runs around the consumer handler to resolve the header for the context policy and to expose the result flags the layout and consumer page use.
| Field | Value |
|---|---|
| Operation ID | OP-10 |
| Trigger | Handler execution on a BolPolicyModel page |
| Inputs | Context policy number, current user |
| Outputs | Header, AccessAllowed, ErrorMessage, ParentAccount, ShowPolicyDropdown |
| Primary components | BolPolicyModel.OnPageHandlerExecuting, BolPolicyModel.OnPageHandlerExecuted, BolPolicyModel.CanViewPolicyDropdown |
| Entry point | src/BolMiddleware/Models/BolPolicyModel.cs |
Steps¶
- If the posted
contextvalueis non-empty, resetParentAccountto zero and store0as theParentAccountcontext value; otherwise leave it (BR-BOLMIDDLEWARE-010). A storedParentAccountgreater than zero is then restored from the context value. - If the context has a policy number, run Resolve policy header (BR-BOLMIDDLEWARE-014, BR-BOLMIDDLEWARE-009).
- When a new header is loaded and
ParentAccountis zero, deriveParentAccountfrom the relationship policy, or from the rate account when no relationship policy exists (BR-BOLMIDDLEWARE-011). - Set
ShowPolicyDropdownthroughCanViewPolicyDropdown, which requires at least one association plus an external or internal predicate: an external user needs aCustomerIdequal to the relationship policy or rate account (or aManualAffiliationassociation withCustomerIdequal toParentAccount); an internal user needs the policy or parent account to equal the relationship policy or rate account (BR-BOLMIDDLEWARE-012). - Validate access, then call the virtual
OnRequestStarthook. After the handler completes,OnPageHandlerExecutedcalls the virtualOnRequestEndhook. - On a failed access check:
ErrorMessageis set and the view components show the error view.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Handler executing]) --> D0{contextvalue posted?}
D0 -->|Yes| S1[Reset ParentAccount to zero]
D0 -->|No| S1b[Keep stored ParentAccount]
S1 --> D1{Policy number in context?}
S1b --> D1
D1 -->|No| EndSkip([Handler runs without header])
D1 -->|Yes| S3[Resolve policy header]
S3 --> S4[Derive ParentAccount if zero]
S4 --> S5[Set ShowPolicyDropdown]
S5 --> S6[Validate access then OnRequestStart]
S6 --> EndOk(["Handler runs, then OnRequestEnd"])
Failure and edge-case behavior¶
- Access validation reads
Task.Resulton an async call, which blocks a request thread and can deadlock in a synchronization context. - The handler still runs when access is denied; derived pages must check
AccessAllowedthemselves. - Exception messages are stored in
ErrorMessageand displayed to the user.
Related documentation¶
- Index
- Overview
- Architecture
- Dependencies
- Configuration
- Operations and processes
- Business rules
- Security and authorization
- Service registration
- API reference
Sources¶
- src/BolMiddleware/Models/BolPolicyModel.cs
- src/BolMiddleware/Services/Security/SecurityService.cs