Class SecuredMenuItem

java.lang.Object
com.svenruppert.jsentinel.components.SecuredMenuItem

@ExperimentalJSentinelApi public final class SecuredMenuItem extends Object
Permission-aware binding helper for Vaadin MenuItems.

Unlike SecuredButton and SecuredRouterLink this is not a subclass: MenuItem is created by the parent MenuBar.addItem(...) call and cannot be instantiated directly. The helper instead takes a freshly-added MenuItem and a SecuredVisibility.Requirement, performs the check once, and exposes a refresh() method for re-checks after a permission change.

Defaults to SecuredVisibilityMode.HIDE — menu entries the user can't trigger should not appear in the menu.

Typical usage:

  MenuBar menu = new MenuBar();
  MenuItem delete = menu.addItem("Delete", e -> svc.delete());
  SecuredMenuItem secured = SecuredMenuItem.bind(delete,
      SecuredVisibility.Requirement.permission(new PermissionName("document:delete")));
  // later, after a role change: secured.refresh();

This is a UI affordance only — the actual delete handler must still server-side-guard the operation.