nocobase-app-plugin-authz-restriction-rules
Qué hace
Esta skill añade reglas de restricción que limitan qué registros puede alcanzar una acción en una aplicación NocoBase 3. Es para administradores que deben mantener ciertos registros fuera del alcance de algunos usuarios.
Cuándo usarla
- ✓Cuando algunos equipos nunca deben ver ciertos registros, como proyectos confidenciales.
- ✓Cuando un límite debe aplicarse en todos los caminos hacia una colección.
- ✓Cuando necesitas revisar o gestionar reglas de restricción existentes en producción.
Link de la skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-restriction-rules/skills/nocobase-app-plugin-authz-restriction-rules/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Ayúdame a asegurar que el equipo de ingeniería nunca pueda ver los proyectos confidenciales de mi aplicación NocoBase.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La IA crea una regla que cruza los registros que alcanza una acción con la selección permitida, para los sujetos indicados. Las reglas de restricción solo limitan el acceso y nunca lo conceden.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Develop restriction rules
A restriction rule intersects the records an action reaches with the rule's selection, for the subjects it lists. The selection describes the records still allowed, not the records to hide. Several matching restrictions all apply; none can grant an action or widen a range.
Read the installed nocobase-app-plugin-authorization Skill first for composite resources, data scopes, fields, server policy enforcement and inherited subjects. The package README at node_modules/@nocobase/app-plugin-authz-restriction-rules/README.md is the complete reference for the service, the HTTP routes and the exports; this Skill covers how to use them.
For a restriction assigned to a department, or to the root department for the whole company, read the application development Skill's references/organization/permission-design.md first. Its core works with permission sets alone and says how to keep excluded records out without this plugin; its optional restriction section covers this one.
Development workflow
- State the invariant positively, for example "this team may access only non-confidential projects". Define who it applies to and whether it covers one operation or every path to a collection.
- Use a rule on a composite, with
scopeKey, for an operation-specific limit. For a limit across every business branch, create a rule on thedatabase.collectionwith its CRUD actions; declared business data scopes and collection-wide invariants are both provisioned through the HTTP routes or the service. - Register a suitable record access and save the complete rule. Apply the restriction directly to a user as well when it must remain after that person's team membership is removed.
- Bind policies on all protected reads and writes. For relation targets, declare relation record access explicitly; a standalone collection restriction is not inherited by nested relation writes.
- Verify the excluded row stays inaccessible after adding broad sharing and another permission set, across each protected operation, and that unrelated actors keep their intended access.
For example, a confidentiality restriction assigned directly to each account holds whichever permission set grants the action. Test with ordinary users: unrestricted identities skip every rule.
Install
Register the default export of @nocobase/app-plugin-authz-restriction-rules/client in client/plugins.ts and of @nocobase/app-plugin-authz-restriction-rules/server in server/plugins.ts, beside the main authorization plugin, and run the application's migrations. Add the factory to the plugins of server/config/authorization.ts, merged with the application's other rule factories:
import { restrictionRules } from '@nocobase/app-plugin-authz-restriction-rules/server';
import {
defineAppConfig,
type AppConfigFactory,
} from '@nocobase/app-server/config';
import type { AuthorizationConfig } from '@nocobase/app-plugin-authorization/server';
const authorization: AppConfigFactory<AuthorizationConfig> = defineAppConfig(
() => ({ plugins: [restrictionRules()] }),
);
export default authorization;
During setup the factory registers the settings item authorization.restriction-rules (group authorization, actions read, create, update, delete) and its routes under /api/authorization/restrictionRules, which the running application documents at /api/swagger/docs under the Authorization tag. Without the factory in the configuration the plugin adds no API and no route.
Service API
Resolve authorizationToken from @nocobase/app-plugin-authorization/server in the owning provider or route factory. The rule API exists only when the factory is configured, so narrow the service before using it. quotes is the application's own composite, sales.public its own record access and org.team its own subject type, all defined as the main Skill describes.
import { selection } from '@nocobase/authorization/core';
import {
defineRestrictionRule,
type RestrictionRulesAuthorizationApi,
} from '@nocobase/authorization/restriction-rules';
import type { DatabaseConnection } from '@nocobase/db';
if (!('restrictionRules' in authz))
throw new Error('Restriction rules is not configured');
const rules = (
authz as typeof authz & RestrictionRulesAuthorizationApi<DatabaseConnection>
).restrictionRules;
await rules.create(
defineRestrictionRule('public-proposals', quotes.reference())
.title('Exclude confidential
Preguntas frecuentes
¿Una restricción puede dar acceso?
No. Solo limita lo que ya está permitido.
¿Se combinan varias reglas?
Sí. Todas las restricciones que coinciden se aplican a la vez.
¿En qué se diferencia del acceso por defecto?
El acceso por defecto fija una base común, mientras que las reglas de restricción limitan lo que pueden alcanzar las personas.
Detalles
Descripción original del autor
Design, implement and verify restriction rules for NocoBase 3 business operations, including named data scopes and production administration.
repo: nocobase/nocobase
Popularidad
- Estrellas en GitHub
- 25 mil
- Posición en el ranking
- #10092
- Licencia
- —
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
nocobase-app-development
25 milAyuda a tu agente a crear páginas, rutas, datos, permisos y pruebas para una aplicación de negocio completa en NocoBase 3.
shadcn
25 milAyuda a tu agente a encontrar, añadir, arreglar y dar estilo a componentes de shadcn/ui en un proyecto web, usando su documentación oficial y sus registros.
nocobase-app-plugin-development
25 milAyuda a tu agente a crear y mantener plugins de NocoBase 3 dentro de una app existente, incluidas las partes de servidor, cliente, base de datos y registro.
nocobase-app-upgrade
25 milAyuda a tu agente a actualizar una app de NocoBase a una versión más nueva de la plantilla, incorporando sus cambios sin perder tu trabajo.
Skills parecidas
reverse-engineer-anything
422 milAyuda a tu agente a revisar apps y paquetes ya publicados para explicar sus funciones, comparar versiones o guiar una reconstrucción, usando la herramienta REA.
1password
394 milAyuda a tu agente a instalar la CLI de 1Password, iniciar sesión y leer o inyectar secretos sin imprimir sus valores en el chat.
healthcheck
394 milAyuda a tu agente a auditar el ordenador o servidor que ejecuta OpenClaw en busca de riesgos de seguridad, como SSH, cortafuegos, actualizaciones y copias de seguridad, y después sugerir arreglos seguros.