Skip to content

Load the user's authorized menu

Constructs the NavigationContext that backs every subsequent menu-authorization check in the session. This is the only point in this library where Oracle is accessed, and it is delegated entirely to SAIF.Business.Menu.

Field Value
Operation ID OP-MVC-06
Trigger First request of a session (step 5 of Initialize a request)
Inputs User ID (upper-cased, trimmed)
Outputs MenuAuthorizedItems collection cached for the session
Primary components NavigationContext.New(inUser As String)
Entry point SAIF.Presentation.Web.MVC/NavigationContext.vb

Steps

  1. Construct clsMSOracleDataLayer with DB user MENU and the connection string from AppGlobal.EnvironmentService.GetConfigSetting(EnvironmentConfigKeys.OracleDatabase) (BR-MVC-015).
  2. Obtain IDataPortalInfo from the data layer.
  3. Call clsMenuAuthorizedItemCollection.GetMenuAuthorizedItems(dpi, user.Trim.ToUpper) (BR-MVC-015).

Origin: The authorized-item query itself — its SQL text and the Oracle menu tables it reads — is defined in SAIF.Business.Menu, not in this library. See that library's own operations and SQL documentation for the query implementation. 4. Application codes and menu categories are loaded lazily on first property access and held in Static locals shared across all instances for the lifetime of the application domain (BR-MVC-018). - On first access within the process: a fresh load runs against Oracle. - On subsequent access: the cached Static value is returned without a database round trip.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([NavigationContext.New]) --> S1[Build clsMSOracleDataLayer as user MENU]
    S1 --> S2[Obtain IDataPortalInfo]
    S2 --> S3[GetMenuAuthorizedItems for user]
    S3 --> S4{ApplicationCodes / MenuCategories accessed?}
    S4 -->|First time| S5[Load from Oracle, cache in Static local]
    S4 -->|Already cached| S6[Return cached value]
    S5 --> EndOk([MenuAuthorizedItems cached in session])
    S6 --> EndOk

Failure and edge-case behavior

  • Because ApplicationCodes/MenuCategories are cached at the application-domain level, a reference-data change requires a process recycle to take effect (BR-MVC-018).
  • The per-session MenuAuthorizedItems set, by contrast, is loaded fresh for every new session, so a user's grants can change between sessions without a recycle (BR-MVC-006).

Sources

  • SAIF.Presentation.Web.MVC/NavigationContext.vb