SolidJS component that conditionally renders children based on permission checks.
// Source: https://github.com/iota-uz/iota-sdk | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { type JSX, mergeProps, createSignal, createMemo, createEffect, on, onMount, onCleanup, untrack, createContext, useContext, lazy, Suspense, createUniqueId, Show, For } from "solid-js";
/**
* PermissionGuard Component
* Conditionally renders children based on permission checks
*
* @example
* // Single permission
* <PermissionGuard permissions={['chat.read']} hasPermission={hasPermission}>
* <ChatList />
* </PermissionGuard>
*
* // Multiple permissions (AND logic - all required)
* <PermissionGuard permissions={['chat.read', 'chat.write']} mode="all">
* <AdminPanel />
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key