Skip to content

Interface: HasRoleProps ​

Defined in: packages/sveltekit/src/props.ts:37

Props of <HasRole>. Conditions are ANDed; without any condition nothing passes (deny by default).

svelte
<HasRole role="admin|editor">...</HasRole>
<HasRole allOf={['writer', 'editor']}>...</HasRole>

Properties ​

PropertyTypeDescriptionDefined in
allOf?NameListPasses with ALL of these roles.packages/sveltekit/src/props.ts:43
anyOf?NameListPasses with ANY of these roles.packages/sveltekit/src/props.ts:41
children?Snippet<[]>-packages/sveltekit/src/props.ts:46
fallback?Snippet<[]>Rendered when the check fails.packages/sveltekit/src/props.ts:48
not?booleanInvert the check (render children when the user does NOT have the roles).packages/sveltekit/src/props.ts:45
role?NameListThe role, or ANY of the roles ('writer|editor' or a list).packages/sveltekit/src/props.ts:39

Released under the MIT License. Inspired by spatie/laravel-permission.