nocobase-app-plugin-authz-restriction-rules
O que ela faz
Esta skill adiciona regras de restrição que reduzem quais registros uma ação pode alcançar em um app NocoBase 3. Ela é indicada para administradores que precisam manter certos registros fora do alcance de alguns usuários.
Quando usar
- ✓Quando algumas equipes nunca podem ver certos registros, como projetos confidenciais.
- ✓Quando um limite deve valer para todos os caminhos de acesso a uma coleção.
- ✓Quando você precisa verificar ou gerenciar regras de restrição existentes em produção.
Link da skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-restriction-rules/skills/nocobase-app-plugin-authz-restriction-rules/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Você pode garantir que a equipe de engenharia nunca veja projetos confidenciais no meu app NocoBase?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A IA cria uma regra que cruza os registros alcançados por uma ação com a seleção permitida, para os sujeitos listados. As regras de restrição apenas reduzem o acesso e nunca o concedem.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do 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
Perguntas frequentes
Uma restrição pode dar acesso?
Não. Ela só reduz o que já é permitido.
Várias regras se combinam?
Sim. Todas as restrições correspondentes se aplicam ao mesmo tempo.
Como ela difere do acesso padrão?
O acesso padrão define uma base compartilhada, enquanto as regras de restrição reduzem o que as pessoas podem alcançar.
Detalhes
Descrição original do autor
Design, implement and verify restriction rules for NocoBase 3 business operations, including named data scopes and production administration.
repo: nocobase/nocobase
Popularidade
- Estrelas no GitHub
- 25 mil
- Posição no ranking
- #10092
- Licença
- —
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
nocobase-app-development
25 milAjuda seu agente a criar páginas, rotas, dados, permissões e testes para uma aplicação de negócios completa no NocoBase 3.
shadcn
25 milAjuda seu agente a encontrar, adicionar, corrigir e estilizar componentes shadcn/ui em um projeto web, usando a documentação oficial e os registros deles.
nocobase-app-plugin-development
25 milAjuda seu agente a criar e manter plugins do NocoBase 3 dentro de um app existente, incluindo as partes de servidor, cliente, banco de dados e registro.
nocobase-app-upgrade
25 milAjuda seu agente a atualizar um app NocoBase para uma versão mais nova do template, trazendo as mudanças do template e mantendo o seu trabalho.
Skills parecidas
reverse-engineer-anything
422 milAjuda seu agente a analisar apps e pacotes já publicados para explicar recursos, comparar versões ou orientar uma reconstrução, usando a ferramenta REA.
1password
394 milAjuda seu agente a configurar a CLI do 1Password, fazer login e ler ou injetar segredos sem imprimir seus valores no chat.
healthcheck
394 milAjuda seu agente a auditar o computador ou servidor que roda o OpenClaw em busca de riscos como SSH, firewall, atualizações e backups, com correções seguras.