react-permission-patterns

Implements permission-based rendering and route guards in ASP.NET Zero React applications.

Updated May 22, 2026
One-click install
npx skills add https://github.com/shakesoft/timekeeper --skill react-permission-patterns-shakesoft
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-permission-patterns
Source: https://github.com/shakesoft/timekeeper/tree/main/.cursor/skills/react-permission-patterns
Command: npx skills add https://github.com/shakesoft/timekeeper --skill react-permission-patterns-shakesoft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React frontends in ASP.NET Zero applications must hide or show UI elements based on backend-defined permissions, and doing this inconsistently leads to unauthorized actions being visible or routes being accessible to the wrong users. ## Core Features & Use Cases - Permission Check Utilities: Wraps abp.auth.isGranted into reusable isGranted and isAnyGranted helper functions. - Conditional Rendering Patterns: Shows how to guard Create, Edit, and Delete buttons with the matching permission strings. - Route Guard Component: Provides a reusable PermissionGuard component that renders children only when the user holds the required permission. - Use Case: When building a Products page, guard the Edit and Delete buttons with 'Pages.Products.Edit' and 'Pages.Products.Delete', and wrap the entire page in a PermissionGuard requiring 'Pages.Products'. ## Quick Start Add permission checks to my React product page so the edit and delete buttons only render for users with the matching ASP.NET Zero permissions.

Frequently Asked Questions about react-permission-patterns

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

FAQPage Schema
How do I conditionally render buttons based on permissions in React?▼

Wrap the button in a permission check using abp.auth.isGranted, typically via an isGranted helper function. The button only renders when the current user holds the specified permission string, such as 'Pages.Products.Edit'.

How to create a route guard component in React with ASP.NET Zero?▼

Build a PermissionGuard component that accepts a permission string and children, then renders the children only when isGranted returns true, otherwise rendering an optional fallback. Wrap page components with it to enforce route-level access.

What permission strings does abp.auth.isGranted expect?▼

The strings must exactly match the constants defined in AppPermissions.cs on the backend, such as 'Pages.Products', 'Pages.Products.Create', 'Pages.Products.Edit', and 'Pages.Products.Delete'. Mismatched strings cause checks to fail silently.

Why is my permission check always returning false in ASP.NET Zero React?▼

The most common cause is a permission string that does not exactly match the AppPermissions.cs constant value, including casing. Also verify the user's role actually grants that permission and that the abp.auth session has loaded before rendering.

Should I hide the actions column when the user has no permissions?▼

Yes, the actions column should be hidden entirely if the user holds none of the relevant permissions, rather than rendering an empty column. Check all applicable permissions with isAnyGranted before rendering the column.