nocobase-app-plugin-authorization

Implements resource registration, route guards, and database access conditions for NocoBase 3 authorization.

9|3|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/nocobase/nocobase3 --skill nocobase-app-plugin-authorization-nocobase
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nocobase-app-plugin-authorization
Source: https://github.com/nocobase/nocobase3/tree/main/packages/plugins/app-plugin-authorization/skills/nocobase-app-plugin-authorization
Command: npx skills add https://github.com/nocobase/nocobase3 --skill nocobase-app-plugin-authorization-nocobase

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Adding authorization to a NocoBase 3 module requires coordinating resource registration, route protection, field-level and record-level database conditions, and Permission Set configuration, and mistakes in any layer can silently expose data. ## Core Features & Use Cases - Resource and Collection Registration: Register database collections and custom resource types with actions, fields, and owner attributes so Permission Sets, Default Access, Sharing Rules, and Restriction Rules can configure them. - Route and Query Protection: Apply authz.guard() for yes/no checks and authorize() to obtain database filter and field conditions that are compiled directly into SQL WHERE clauses. - Business Permission Configuration: Create and assign Permission Sets, configure Default Access, Sharing Rules, and Restriction Rules, and diagnose decisions with authz.explain(). - Use Case: A developer building an Orders module registers the orders collection, protects CRUD routes so contractors only see their own records, and grants sales managers full access through a Permission Set. ## Quick Start Ask the agent to add authorization to your NocoBase module by registering its collection and protecting its routes with database access conditions.

Frequently Asked Questions about nocobase-app-plugin-authorization

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

FAQPage Schema
How do I add authorization to a NocoBase module?▼

Register the module's collection with authz.database.collections.add(), run authz.middleware() before routes, and call authorize() in each route to obtain database conditions. The module's service then applies the returned filter and field limits inside its queries.

How do I protect a NocoBase route with a permission check?▼

Use authz.guard() for routes needing a simple permit or deny decision, passing the resource and action. For database CRUD routes, use authorize() instead because the decision carries record filters and field conditions the service must apply.

What is the difference between Permission Sets, Sharing Rules, and Restriction Rules in NocoBase?▼

Permission Sets grant actions to subjects and may include field and record policy. Sharing Rules expand record access for selected subjects, while Restriction Rules narrow effective access as a mandatory upper bound. Default Access sets a resource-wide baseline.

Why does a NocoBase permission check return denied or wrong results?▼

Verify the resource id matches the registered resource, the action is registered, and middleware resolved the principal and subjects. Then check Permission Set assignments, Default Access, Sharing Rules, and Restriction Rules, and call authz.explain() with the same request to inspect decision reasons.

Can I apply record-level filters in memory after fetching records?▼

No. For update and delete, the returned record filter must be placed in the same SQL WHERE clause as the record id. Fetching first and filtering in memory bypasses the authorization boundary and can expose or modify unauthorized records.