Resolve a user's authorized menu items¶
Resolves the complete set of menu items a specific user may reach by combining group-granted items, unsecured items, and the user's own favorites into a single read-only, denormalized projection. This is the query that backs every subsequent page-authorization check in the requesting web session.
| Field | Value |
|---|---|
| Operation ID | OP-MENU-01 |
| Trigger | NavigationContext.New(user) — once per web session |
| Inputs | IDataPortalInfo, menu user ID (trimmed, upper-cased by the caller) |
| Outputs | Populated clsMenuAuthorizedItemCollection |
| Primary components | clsMenuAuthorizedItemCollection.GetMenuAuthorizedItems(inDataportal, inMenuUser) |
| Entry point | SAIF.Business.Menu/clsMenuAuthorizedItemCollection.vb |
Steps¶
- Construct
Criteria(dpi, menuUser)and calldpi.DataAccessLayer.RetrieveObject. BeforeRetrievecreates a data request with IDBOC.RetrieveSQL. IfMyCriteria.MenuUseris non-empty, useRetrieveSQL(SQL-015) andAddParm("MenuUser", value, 30); otherwise useRetrieveAllSQL(SQL-016, no parameter). (BR-MENU-001)- The framework executes the three-branch
UNION: - Branch 1 (group-granted) —
SELECT DISTINCTitems joined item → security → security-user → page → application → category, matchingupper(USR.SECURITY_GROUP_TXT) = upper(SEC.SECURITY_GROUP_TXT)andUSR.MENU_USER = :MenuUser, markedUnsecuredFlag = 'N',FavoriteFlag = 'N'. (BR-MENU-002, BR-MENU-003; tables MENU_ITEM, MENU_SECURITY, MENU_SECURITY_USER, MENU_PAGE, BUSONLINE_APPS_CODE, MENU_CATEGORY_CODE) - Branch 2 (unsecured) — items with
NOT EXISTS (SELECT 1 FROM menu_security …), markedUnsecuredFlag = 'Y', with:MenuUserechoed as the owner and aNULLemployee ID. (BR-MENU-004) - Branch 3 (favorites) — items joined to MENU_FAVORITE where
FAV.MENU_USER = :MenuUserandFAV.ITEM_INACTIVE_DATE IS NULL, ordered byFAV.MENU_ORDER_NUM, markedFavoriteFlag = 'Y'. (BR-MENU-005, BR-MENU-006) AfterRetrievecasts the result toIDataReader, and for each row constructs aclsMenuAuthorizedItem, callsLoad(which fills all 28 columns, builds aCriteria, and callsMarkOld), and adds it to the collection.- On failure: a missing or renamed column surfaces as a runtime error from the reader.*
- The collection is returned to the caller and cached in web session by the MVC layer. (BR-MENU-007)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([NavigationContext session start]) --> Criteria[Construct Criteria dpi, menuUser]
Criteria --> Choice{MenuUser supplied?}
Choice -->|Yes| Filtered[RetrieveSQL: three-branch UNION scoped to user]
Choice -->|No| All[RetrieveAllSQL: three-branch UNION for all users]
Filtered --> Load[AfterRetrieve: Load each clsMenuAuthorizedItem]
All --> Load
Load --> Cache([Return collection, cache in web session])
Failure and edge-case behavior¶
- A missing or renamed column in the result set surfaces as a runtime error from
AfterRetrieverather than a handled business error.* - Requesting an unknown
MenuUseryields an empty collection (no rows satisfy any of the three UNION branches) rather than an error.
Related documentation¶
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.Business.Menu/clsMenuAuthorizedItemCollection.vb