Skip to content

Maintain a menu item together with its security-group assignments

Saves a menu item and its child security-group rows as one logical change.

Field Value
Operation ID OP-MENU-003
Trigger Caller edits a menu item and its security groups.
Inputs IDataPortalInfo, menu-item fields, security groups
Outputs Persisted item and security rows
Primary components clsMenuItem, clsMenuSecurityCollection
Entry point SAIF.Business.Menu\clsMenuItem.vb

Steps

  1. Create a new menu-item key with SQL-MENU-012 or load an existing item with SQL-MENU-015.
  2. Save the parent row through SQL-MENU-014 or SQL-MENU-016 against MENU_ITEM.
  3. Lazy-load child security groups with SQL-MENU-030 when the caller accesses SecurityGroups.
  4. Evaluate IsValid and IsDirty so the item inherits child state from SecurityGroups (BR-MENU-005).
  5. When the parent save succeeds and the child collection is dirty, create keys with SQL-MENU-024 and persist child rows with SQL-MENU-026 or SQL-MENU-028 against MENU_SECURITY. User-to-security-group membership rows in MENU_SECURITY_USER are maintained separately; see Maintain reference data.
  6. Delete obsolete rows with SQL-MENU-013 or SQL-MENU-025 as required, and rely on row-count checking after every write (BR-MENU-001).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Caller edits menu item]) --> LoadItem[Create or retrieve item]
    LoadItem --> EditItem[Change item fields]
    EditItem --> LoadGroups[Load security groups]
    LoadGroups --> Validate[Evaluate IsValid and IsDirty]
    Validate --> PersistItem[Save MENU_ITEM]
    PersistItem --> PersistGroups[Save dirty MENU_SECURITY rows]
    PersistGroups --> Done([Return saved item])

Failure and edge-case behavior

  • The child SecurityGroups collection can keep the parent item dirty even when the parent fields did not change (BR-MENU-005).
  • Unassigned items become public at read time because authorization treats missing security rows as unsecured (BR-MENU-002).

Sources

  • SAIF.Business.Menu\clsMenuItem.vb