Permissions
Design principles, placement strategies, user experience guidance, and accessibility considerations for Permission Shield, Permission Provider, and 403 context cards.
Providing actionable, transparent feedback is essential when guiding users through permission-controlled cloud environments. The following guidelines help teams effectively implement authorization gates.
When to Use: Shield vs. Hide
Different UI surfaces require different authorization degradation strategies. Sistent supports two primary actions: showShield and hide.
Use showShield (or permissionAction="showShield") when:
- In-Page Affordances: The user is on a workspace, project, or settings page where an action button (e.g., "Deploy Pattern", "Add Node", "Export Telemetry") is visible to all members but executable only by admins or operators.
- Educational Discoverability: You want the user to know that a capability exists, understand what role or key is required, and request access from an administrator.
- Contextual Forms: Fields, menu items, or inputs where certain actions are restricted to specific roles.
Use hide (or permissionAction="hide") when:
- Primary Navigation Menus: Navbars and sidebar menus should hide unreachable top-level sections and pages to prevent menu bloat and clutter.
- Destructive Admin Consoles: Management consoles that are irrelevant to non-admin tenants.
- Extension Points: Pluggable cards or sidebar panels intended only for privileged roles.
Supported Base Components
Sistent base components natively support permissionKey and permissionAction without needing a manual <PermissionShield> wrapper:
<Button permissionKey={...} permissionAction="showShield" | "hide" /><IconButton permissionKey={...} permissionAction="showShield" | "hide" /><MenuItem permissionKey={...} permissionAction="showShield" | "hide" /><ListItem permissionKey={...} permissionAction="showShield" | "hide" /><ListItemButton permissionKey={...} permissionAction="showShield" | "hide" />
When permissionAction="showShield" is used on these components:
Button,ListItem,ListItemButton, andMenuItemdefault to the inline shield variant.IconButtondefaults to the badge shield variant.
Anatomy of the Shield & Tooltip
The PermissionShield tooltip contains structured metadata designed to resolve access requests efficiently:
- Authorization Header: Clear title indicating
AUTHORIZATION REQUIRED. - Requirement Combinator: Explains whether the user requires all keys (
Needs all of:) or any single key (Needs any of:). - Key Metadata Blocks: For each unmet key, displays:
- Copy Key ID Trigger: Clicking the key icon copies the canonical UUID to clipboard for sharing with system administrators.
- Permission Function Name: Clear human-readable action name (e.g., "Create Workspace").
- Description: Explanatory copy clarifying what capability the key grants.
- Category & Subcategory Chips: Granular taxonomy tags for quick categorization.
- Key Reference Link: Direct link to official permissions documentation.
- Active User Context: Displays the current user's name, active organization, and Assigned Roles.
- Support Callout: Prompt directing the user to contact their organization administrator.
The Assigned Roles Contract
Critical Invariant: The user context rendered inside the tooltip and 403 context cards must always reflect the roles the user is assigned in the active organization, never the organization's total role catalog.
- Displaying the org role catalog mistakenly informs users that they possess roles they do not hold.
- When a user holds no assigned roles in the active tenant space, the component cleanly reports
Role(s): None.
Multi-Tenant Organization Switching
When users encounter a 403 Access Denied page, the useAccessibleOrgs hook queries other organizations the user belongs to in parallel. If the user possesses the required permission in a sibling organization, an Organization Switcher dropdown allows instant switching without leaving the flow.
Accessibility & Keyboard Navigation
- Non-Obstructive Dimming: Guarded children receive
opacity: 0.5andpointer-events: nonewhile remaining in the accessibility tree. - Focusable Shield Trigger: The shield icon trigger is keyboard-focusable with
tabIndex="0"and triggers via Enter or Space. - Screen Reader Labels: Copy triggers supply descriptive
aria-labeltags (e.g.aria-label="Copy key ID for Create Workspace"). - Click-Away Dismissal: Tooltips automatically close when the user clicks outside or focuses another element.
Performance Tips
- Memoized Evaluator: Pass a stable or memoized
userHasPermissionfunction toPermissionProviderto avoid unnecessary re-renders of the component tree. - Lazy Org Evaluation: The
useAccessibleOrgshook is designed specifically for 403 error pages. Do not mount it on high-frequency navigation bars.