---
title: Load a user's group memberships
summary: Loads the security-group memberships recorded for one user, or all memberships when no user is supplied. This operation carries a known inverted-branch defect in its parameter binding.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Business.Menu
reference_type: package
operation_id: OP-MENU-09
trigger: Caller requests `GetMenuSecurityUserForUser`
---

# Load a user's group memberships

Loads the security-group memberships recorded for one user, or all memberships when no user is supplied. This operation carries a known inverted-branch defect in its parameter binding.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-09 |
| **Trigger** | Caller requests `GetMenuSecurityUserForUser` |
| **Inputs** | `IDataPortalInfo`, menu user ID |
| **Outputs** | Populated `clsMenuSecurityUserCollection` |
| **Primary components** | `clsMenuSecurityUserCollection.GetMenuSecurityUserForUser` |
| **Entry point** | `SAIF.Business.Menu/clsMenuSecurityUserCollection.vb` |

## Steps

1. Build `Criteria(dpi, menuUser)`.
2. `BeforeRetrieve`: when `MenuUser` is non-empty it selects `retrieveForUserSQL` ([SQL-030](../sql/SQL-030-retrieve-menu-security-users-for-user.md), `WHERE MENU_USER = :MenuUser`) — **but the `AddParm("MenuUser", …)` call sits in the `Else` branch**, so the parameterized statement is issued without its bind variable while the unfiltered statement ([SQL-029](../sql/SQL-029-retrieve-all-menu-security-users.md)) receives a superfluous parameter. ([BR-MENU-001](../business-rules.md#br-menu-001-scoped-vs-unfiltered-retrieval); table [MENU_SECURITY_USER](../database-tables.md#menu_security_user))
   - On failure: this inverted-branch defect means the user-scoped path is expected to fail at execution (missing bind variable for `:MenuUser`).*
3. `AfterRetrieve` loads one `clsMenuSecurityUser` per row.

## Process flow

```mermaid
flowchart TD
    Start([GetMenuSecurityUserForUser]) --> Choice{MenuUser supplied?}
    Choice -->|Yes| ByUser[retrieveForUserSQL selected, but AddParm MenuUser is NOT called]
    Choice -->|No| All[Unfiltered statement selected, AddParm MenuUser called anyway]
    ByUser --> Exec1([Execution likely fails: missing bind variable])
    All --> Load[AfterRetrieve: Load each clsMenuSecurityUser]
    Load --> Done([Return populated collection])
```

## Failure and edge-case behavior
- User-scoped retrieval (`MenuUser` supplied): the parameterized SQL is issued without its bind variable — this is expected to fail at execution rather than return a filtered result.*
- Unfiltered retrieval (`MenuUser` empty): a stray `AddParm("MenuUser", …)` call executes against a statement with no matching bind placeholder; behavior in that case is unconfirmed.**

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **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/clsMenuSecurityUserCollection.vb
