add-permission

Add authorization permissions across .NET server and React admin UI.

6.7k|2.0k|Updated Aug 20, 2021
One-click install
npx skills add https://github.com/fullstackhero/dotnet-starter-kit --skill add-permission-fullstackhero
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-permission
Source: https://github.com/fullstackhero/dotnet-starter-kit/tree/main/.agents/skills/add-permission
Command: npx skills add https://github.com/fullstackhero/dotnet-starter-kit --skill add-permission-fullstackhero

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents authorization bugs when you add a new endpoint by ensuring the permission constant, server gate, and admin UI routing are kept in sync.

Core Features & Use Cases

  • Adds a server-side permission constant to the correct module resource group and includes it in the module’s All collection for registration.
  • Gates a backend endpoint with .RequirePermission(...) so unauthorized requests reliably receive a 403.
  • Mirrors the permission in the admin app so the permissions catalog and role/route guard logic can recognize it.
  • Updates admin test seeding so RouteGuard passes on first paint in E2E scenarios.
  • Use case: when a new admin-facing “create” action needs authorization, you add the matching permission and wire both the backend and admin UI to enforce it consistently.

Quick Start

Add the new permission constant to the module’s {X}Permissions All list, then gate the target endpoint with .RequirePermission(...) and mirror the permission in the admin app permission tree plus route guard.

Frequently Asked Questions about add-permission

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

FAQPage Schema
How do I add a new authorization permission to a .NET and React admin app?

To add a new authorization permission, you register a constant in the module's `All` collection, gate the backend endpoint with `.RequirePermission(...)`, and mirror the string in the React admin UI route guard and permissions catalog.

Why does my React admin RouteGuard fail on first paint for new protected endpoints?

The React admin RouteGuard fails on first paint when admin test seeding is not updated to include the new permission. You must mirror the permission string in the test seeding data so RouteGuard passes in E2E scenarios.

How do I enforce a 403 response on a protected .NET endpoint without duplicating permission metadata?

You enforce a 403 response by attaching `.RequirePermission(...)` metadata to the endpoint, ensuring you avoid duplicate `IRequiredPermissionMetadata` entries while keeping the server gate synchronized with the permission constant.

When do I need to wire permissions end-to-end across multitenancy applications?

You need to wire permissions end-to-end when introducing new protected admin flows, such as a "create" action, so the .NET server gate and React UI routing consistently enforce visibility and authorization through the Role editor.

Does adding JWT permissions require updating the React permissions catalog?

Yes, adding JWT permissions requires mirroring the permission string into the React admin permissions catalog so the role editor and route guard logic can recognize and enforce the new authorization rule.