NavigationContext¶
NavigationContext is the per-user, per-session cache of authorized menu items that backs every menu-authorization decision in this library. It is constructed once per session by clsControllerBase.Initialize (cached in Session("navdata")), loading the user's authorized items from Oracle through SAIF.Business.Menu's clsMenuAuthorizedItemCollection, and it is the type whose IsMenuItem method implements the library's only enforceable authorization decision — see Load the user's authorized menu, Enforce menu-based page authorization, and Security and authorization. Its ApplicationCodes and MenuCategories reference data are cached at the application-domain level (Static locals), independent of any individual NavigationContext instance's lifetime.
Purpose¶
- Loads and holds the authorized menu item set for a single user for the lifetime of their session (BR-MVC-006).
- Answers "may this user reach this application/page?" through
IsMenuItem, the sole enforceable page-authorization check in this library (BR-MVC-007). - Resolves the currently executing page's menu metadata (
GetCurrentItem,GetCurrentPage) from the liveHttpContext.Current.Request, so screens can look up their own menu sequence/category without separately parsing the URL. - Caches reference data (
ApplicationCodes,MenuCategories) at the process level so repeated lookups do not re-query Oracle (BR-MVC-018).
Context¶
- Namespace:
SAIF.Presentation.Web.MVC* - Assembly/package:
SAIF.Presentation.Web.MVC
Public members¶
| Member | Signature | Purpose |
|---|---|---|
New |
Public Sub New(ByVal inUser As String) |
Builds a clsMSOracleDataLayer under DB user MENU using the oracleDatabase environment setting, then loads MenuAuthorizedItems for the upper-cased, trimmed user name; see Load the user's authorized menu |
MenuAuthorizedItems |
Public Property MenuAuthorizedItems() As clsMenuAuthorizedItemCollection |
The current user's authorized menu item collection, loaded from SAIF.Business.Menu |
DumpDataToString |
Public ReadOnly Property DumpDataToString() As String |
Diagnostic string combining the authorized-item count and a full dump of every menu item, for troubleshooting/tracing |
ApplicationCodes |
Public ReadOnly Property ApplicationCodes() As clsApplicationCodeCollection |
The active application code reference collection, loaded from Oracle on first access process-wide and cached thereafter |
MenuCategories |
Public ReadOnly Property MenuCategories() As clsMenuCategoryCodeCollection |
The menu category code reference collection, loaded from Oracle on first access process-wide and cached thereafter |
GetItemSeq |
Public Function GetItemSeq(ByVal inApplication As String, ByVal inCategory As String, ByVal inPageLink As String) As Decimal |
Resolves the menu sequence number for a given application/category/page-link triple, or 0 if not found |
GetItem |
Public Function GetItem(ByVal inCategory As String, ByVal inLink As String, Optional ByVal inAnyApp As Boolean = False) As clsMenuAuthorizedItem |
Looks up an authorized menu item by category and link, either within the current application or across all applications when inAnyApp is True |
GetCurrentItem |
Public Function GetCurrentItem(ByVal inCategory As String) As clsMenuAuthorizedItem |
Looks up the authorized menu item matching the current request's application and raw URL, within the given category |
IsMenuItem |
Public Function IsMenuItem(ByVal inApplication As String, ByVal inItem As String) As Boolean |
True when the given application/page pair exists in the user's authorized item set; the enforceable check behind Enforce menu-based page authorization (BR-MVC-007) |
GetCurrentPage |
Public Function GetCurrentPage() As clsMenuAuthorizedItem |
Resolves the authorized menu item for the exact application/page of the current request |
Behavioral notes¶
ApplicationCodesandMenuCategoriesare backed byStaticlocal variables inside privateSharedhelper methods, so the firstNavigationContextinstance constructed in the application domain populates them for every subsequent instance and session — a reference-data change requires a process recycle to take effect (BR-MVC-018).GetItem,GetCurrentItem, andGetCurrentPageall readHttpContext.Currentdirectly rather than accepting the request context as a parameter, so they are only meaningful when called within an active web request.- The query behind
MenuAuthorizedItems, its underlying SQL text, and the Oracle menu schema itself are implemented inSAIF.Business.Menu, not in this library — this type only supplies the connection (clsMSOracleDataLayer) and the user identity.
Constraints and usage notes¶
- The parameterless
Protected Friend Sub New()exists but performs no initialization; the only meaningful constructor isNew(inUser As String), which requires a valid Oracle connection to succeed. - Because
IsMenuItemand related lookups depend onApplicationCodes, an application whose code is missing or misconfigured in theMENUschema will never resolve to a non-emptyappCode, causing every menu lookup for that application to fail closed.*
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
- SAIF.Presentation.Web.MVC/NavigationContext.vb