fe-permissions

Add or review CASL permission checks for Next.js 15 frontend components and routes.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/lety-ai/lety-skill-hub --skill fe-permissions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fe-permissions
Source: https://github.com/lety-ai/lety-skill-hub/tree/main/plugins/casl/skills/casl
Command: npx skills add https://github.com/lety-ai/lety-skill-hub --skill fe-permissions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inconsistent or missing permission checks in the frontend lead to insecure UI surface and leaked functionality where users can see or act on features they should not access. This Skill provides concrete patterns and rules to centralize authorization checks, avoid fragile role-string logic, and ensure route and component-level protection are applied correctly.

Core Features & Use Cases

  • Consistent component checks: Use the permissions store and CASL abilities to show or hide UI elements reliably.
  • Route-level protection: Register permissions on sidebar items so AuthRedirect can automatically block unauthorized access and redirect to the 403 page.
  • Impersonation safety: Enforce restrictions so impersonated users cannot perform destructive DELETE actions even if abilities allow them.
  • Use Case: Add read access to a billing dashboard by updating the sidebar config and verifying that the view redirects unauthorized users to the 403 page.

Quick Start

Add Actions.READ for TenantResourceObjectEnum.BILLING to the sidebar item for /billing and verify AuthRedirect blocks users without that permission.

Frequently Asked Questions about fe-permissions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add permission checks to Next.js 15 App Router routes?

To add permission checks to Next.js routes, register CASL abilities on sidebar items using Actions and TenantResourceObjectEnum enums so AuthRedirect can automatically block unauthorized access and redirect users to a 403 page.

How do I conditionally render UI components based on CASL abilities in Next.js?

To conditionally render UI components based on CASL abilities, use the usePermissionsStore Zustand store to reliably check user permissions and show or hide frontend elements according to their authorized access.

Can I prevent impersonated users from performing destructive actions in Next.js?

Yes, you can prevent impersonated users from performing destructive actions by enforcing specific restrictions that block DELETE operations even if the user's CASL abilities would normally allow them.

Does this approach use role strings for frontend authorization in Next.js?

No, this approach avoids fragile role-string logic by centralizing frontend authorization checks with CASL abilities and a Zustand permissions store to reliably protect UI elements and routes.

How do I protect a billing dashboard route from unauthorized access?

To protect a billing dashboard route, add Actions.READ for TenantResourceObjectEnum.BILLING to the sidebar item configuration and verify that AuthRedirect redirects unauthorized users to the 403 page.