NavigationContext¶
NavigationContext wraps a per-user set of menu/application-code collections sourced from SAIF.Business.Menu (retrieved through an Oracle data layer) and answers "is this page authorized for this user" queries. It is the data-backed authorization mechanism behind BR-MVC-002 and is cached once per session in Session("navdata") by clsControllerBase.Initialize().
Purpose¶
- Resolves whether a given application/page combination is present in the current user's authorized menu set (
IsMenuItem), used to gate every request inclsControllerBase.RedirectUnauthorizedUsers(). - Resolves the current request's matching
clsMenuAuthorizedItem(GetCurrentItem/GetCurrentPage/GetItem) for use by consuming controllers that need menu-item metadata (e.g., item sequence number, category) beyond a simple allow/deny check. - Owns the Oracle data-layer connection (
clsMSOracleDataLayer) used to retrieveSAIF.Business.Menucollections for the constructing user.
Context¶
- Namespace:
SAIF.Presentation.Web.MVC - Assembly/package:
SAIF.BOF.Presentation.Web.Infragistics103(source-bundled)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
MenuAuthorizedItems |
Public Property MenuAuthorizedItems() As clsMenuAuthorizedItemCollection |
The current user's authorized menu items, populated at construction time from SAIF.Business.Menu.clsMenuAuthorizedItemCollection.GetMenuAuthorizedItems. |
DumpDataToString |
Public ReadOnly Property DumpDataToString() As String |
Diagnostic string combining the authorized-item count and a full dump of menu item data; intended for troubleshooting/logging, not production display. |
ApplicationCodes |
Public ReadOnly Property ApplicationCodes() As clsApplicationCodeCollection |
The set of active application codes, lazily retrieved and cached (per-process, via a Shared/Static field) from clsApplicationCodeCollection.GetActiveApplicationCodes. |
MenuCategories |
Public ReadOnly Property MenuCategories() As clsMenuCategoryCodeCollection |
The set of menu category codes, lazily retrieved and cached from clsMenuCategoryCodeCollection.GetMenuCategoryCodes. |
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 specific application/category/page-link combination; returns 0 if no matching authorized item exists. |
GetItem |
Public Function GetItem(ByVal inCategory As String, ByVal inLink As String, Optional ByVal inAnyApp As Boolean = False) As clsMenuAuthorizedItem |
Resolves the authorized menu item for a category/link, either across any application (inAnyApp:=True) or scoped to the current request's application path; falls back from an exact match to a non-exact match. |
GetCurrentItem |
Public Function GetCurrentItem(ByVal inCategory As String) As clsMenuAuthorizedItem |
Resolves the authorized menu item for the current request's application and URL path within a given category; falls back from an exact match to a non-exact match. |
IsMenuItem |
Public Function IsMenuItem(ByVal inApplication As String, ByVal inItem As String) As Boolean |
Returns True only if MenuAuthorizedItems.FindPage(appCode, inItem) finds a match for the application resolved from inApplication; the core check behind BR-MVC-002. |
GetCurrentPage |
Public Function GetCurrentPage() As clsMenuAuthorizedItem |
Resolves the authorized menu item for the current request's exact application/URL path, without a category filter; falls back from an exact match to a non-exact match. |
New() |
Protected Friend Sub New() |
Parameterless constructor; does not populate MenuAuthorizedItems or the Oracle data layer — intended for internal/test construction only. |
New(inUser) |
Public Sub New(ByVal inUser As String) |
Constructs clsMSOracleDataLayer("MENU", <OracleDatabase config>), obtains its IDataPortalInfo, and populates MenuAuthorizedItems for inUser.Trim.ToUpper via clsMenuAuthorizedItemCollection.GetMenuAuthorizedItems. |
Behavioral notes¶
ApplicationCodesandMenuCategoriesare cached inShared/Staticfields scoped to the method, not the instance — once populated by anyNavigationContextinstance in the process, subsequent instances reuse the same cached collections rather than re-querying Oracle.*GetItem,GetCurrentItem, andGetCurrentPageall readHttpContext.Current.Requestdirectly, so they are only meaningful within an active web request — they cannot be used from background/non-web code.- The Oracle connection is established via
EnvironmentConfigKeys.OracleDatabase(see Configuration); the SQL/Criteria implementation behindGetMenuAuthorizedItems/GetActiveApplicationCodes/GetMenuCategoryCodeslives inSAIF.Business.Menu, outside this library.
Constraints and usage notes¶
- Constructing
NavigationContext(inUser)performs an Oracle round-trip;clsControllerBase.Initialize()mitigates repeated construction cost by caching the instance inSession("navdata")for the duration of the session. inUseris upper-cased and trimmed before lookup, so menu authorization is effectively case-insensitive on username.
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¶
- SAIF.Presentation.Web.MVC\NavigationContext.vb