Resolve navigation and authorized menu context¶
NavigationContext is the only type in this library that reaches a database. On construction it loads the current user's authorized menu items from Oracle through SAIF.Business.Menu, then answers all subsequent navigation and authorization questions (current page, item lookup, sequence, menu membership) purely from the in-memory authorized set.
| Field | Value |
|---|---|
| Operation ID | OP-CORE-006 |
| Trigger | Construction of a NavigationContext for a signed-in user, then per-request navigation queries |
| Inputs | User ID (inUser), MENU_ENVIRONMENT app setting, HttpContext.Current.Request.ApplicationPath / RawUrl |
| Outputs | clsMenuAuthorizedItem instances, menu item sequence numbers, menu-membership booleans |
| Primary components | NavigationContext (constructor, GetItem, GetCurrentItem, GetCurrentPage, GetItemSeq, IsMenuItem) |
| Entry point | SAIF.Presentation.Web.Core.Infragistics111/NavigationContext.vb |
Steps¶
- Construct
clsMSOracleDataLayerwith the fixed DB user nameMENUand the environment name read from theMENU_ENVIRONMENTapp setting. (BR-CORE-017) - Obtain an
IDataPortalInfofrom the data layer (m_DAL.DataPortalInfo()). - Call
clsMenuAuthorizedItemCollection.GetMenuAuthorizedItems(dpi, user.Trim.ToUpper)to load the authorized menu items for the user. (BR-CORE-018, BR-CORE-019) -
Origin: The SQL that retrieves the authorized items executes inside
SAIF.Business.Menu(local project reference), not in this library. See that library'soperations/resolve-navigation-and-authorized-menu-context.md-equivalent page for the retrieval logic. - On first access,
ApplicationCodes/MenuCategorieslazily load and cache the active application codes and menu category codes inStaticlocals. (BR-CORE-020) -
Origin: Delegates to
clsApplicationCodeCollection.GetActiveApplicationCodesandclsMenuCategoryCodeCollection.GetMenuCategoryCodesinSAIF.Business.Menu. - Each collection is fetched once per process; subsequent calls reuse the cached value.
- For lookups, resolve the current application code by stripping
/fromRequest.ApplicationPathand matching it withApplicationCodes.ItemByAppPath. - If no application code resolves: return
Nothing/0. (BR-CORE-021) - For
GetCurrentItem/GetCurrentPage, derive the page link fromRequest.RawUrl.Substring(Request.ApplicationPath.Length + 1). - Attempt an exact match first (
ItemExact/FindPageExact). - If no exact match: fall back to the fuzzy match (
Item/FindPage). (BR-CORE-022) GetItemwithinAnyApp = Truebypasses application-code scoping and searches by category across all applications. (BR-CORE-023)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([NavigationContext constructed]) --> S1[New clsMSOracleDataLayer MENU, MENU_ENVIRONMENT]
S1 --> S2[Obtain IDataPortalInfo]
S2 --> S3[GetMenuAuthorizedItems trim/upper user]
S3 --> S4{First access to ApplicationCodes/MenuCategories?}
S4 -->|Yes| S5[Load and cache in Static locals]
S4 -->|No| S6[Reuse cached collections]
S5 --> Query([Ready for navigation queries])
S6 --> Query
Query --> Q1{App path resolves to a code?}
Q1 -->|No| Nothing([Return Nothing / 0])
Q1 -->|Yes| Q2{Exact link match found?}
Q2 -->|Yes| Exact([Return exact match])
Q2 -->|No| Fuzzy([Fall back to fuzzy match])
Failure and edge-case behavior¶
NavigationContextnever re-validates that the supplied user name matches the authenticated identity — that responsibility sits with callers.*- When the application-code cache and the authorized-item set disagree (e.g. after a code is deactivated mid-process), stale application codes persist until a process recycle. (BR-CORE-020)
Related documentation¶
Sources¶
SAIF.Presentation.Web.Core.Infragistics111/NavigationContext.vb