Skip to content

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

  1. Construct Criteria(dpi, menuUser) and call dpi.DataAccessLayer.RetrieveObject.
  2. BeforeRetrieve creates a data request with ID BOC.RetrieveSQL. If MyCriteria.MenuUser is non-empty, use RetrieveSQL (SQL-015) and AddParm("MenuUser", value, 30); otherwise use RetrieveAllSQL (SQL-016, no parameter). (BR-MENU-001)
  3. The framework executes the three-branch UNION:
  4. Branch 1 (group-granted) — SELECT DISTINCT items joined item → security → security-user → page → application → category, matching upper(USR.SECURITY_GROUP_TXT) = upper(SEC.SECURITY_GROUP_TXT) and USR.MENU_USER = :MenuUser, marked UnsecuredFlag = '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)
  5. Branch 2 (unsecured) — items with NOT EXISTS (SELECT 1 FROM menu_security …), marked UnsecuredFlag = 'Y', with :MenuUser echoed as the owner and a NULL employee ID. (BR-MENU-004)
  6. Branch 3 (favorites) — items joined to MENU_FAVORITE where FAV.MENU_USER = :MenuUser and FAV.ITEM_INACTIVE_DATE IS NULL, ordered by FAV.MENU_ORDER_NUM, marked FavoriteFlag = 'Y'. (BR-MENU-005, BR-MENU-006)
  7. AfterRetrieve casts the result to IDataReader, and for each row constructs a clsMenuAuthorizedItem, calls Load (which fills all 28 columns, builds a Criteria, and calls MarkOld), and adds it to the collection.
  8. On failure: a missing or renamed column surfaces as a runtime error from the reader.*
  9. 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 AfterRetrieve rather than a handled business error.*
  • Requesting an unknown MenuUser yields an empty collection (no rows satisfy any of the three UNION branches) rather than an error.

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