nocobase-app-plugin-authz-restriction-rules
Was er macht
Dieser Skill fügt Einschränkungsregeln hinzu, die eingrenzen, welche Datensätze eine Aktion in einer NocoBase-3-App erreichen kann. Er ist für Administratoren, die bestimmte Datensätze für einige Nutzer außer Reichweite halten müssen.
Wann du ihn nutzt
- ✓Wenn bestimmte Teams niemals bestimmte Datensätze sehen dürfen, etwa vertrauliche Projekte.
- ✓Wenn eine Grenze für jeden Zugriffsweg auf eine Collection gelten soll.
- ✓Wenn du bestehende Einschränkungsregeln in der Produktivumgebung prüfen oder verwalten musst.
Link zum Skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-restriction-rules/skills/nocobase-app-plugin-authz-restriction-rules/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Kannst du sicherstellen, dass das Engineering-Team vertrauliche Projekte in meiner NocoBase-App niemals sehen kann?”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Die KI legt eine Regel an, die die von einer Aktion erreichten Datensätze mit der erlaubten Auswahl schneidet, und zwar für die angegebenen Subjects. Einschränkungsregeln engen den Zugriff nur ein und gewähren nie Zugriff.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von 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
Häufige Fragen
Kann eine Einschränkung Zugriff geben?
Nein. Sie engt nur ein, was ohnehin erlaubt ist.
Greifen mehrere Regeln ineinander?
Ja. Alle passenden Einschränkungen gelten gleichzeitig.
Worin unterscheidet sie sich vom Standardzugriff?
Der Standardzugriff legt eine gemeinsame Basis fest, Einschränkungsregeln engen ein, was Nutzer erreichen können.
Details
Originalbeschreibung des Autors
Design, implement and verify restriction rules for NocoBase 3 business operations, including named data scopes and production administration.
repo: nocobase/nocobase
Beliebtheit
- GitHub-Sterne
- 25k
- Platz im Ranking
- #10092
- Lizenz
- —
- Aktualisiert
- 2.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
nocobase-app-development
25kHilft deinem Agenten, Seiten, Routen, Daten, Berechtigungen und Tests für eine vollständige NocoBase-3-Geschäftsanwendung zu bauen.
shadcn
25kHilft deinem Agenten, shadcn/ui-Komponenten in einem Webprojekt zu finden, hinzuzufügen, zu reparieren und zu gestalten, mit den offiziellen Dokumenten und Registern.
nocobase-app-plugin-development
25kHilft deinem Agenten, NocoBase-3-Plugins in einer bestehenden App zu erstellen und zu pflegen, einschließlich Server-, Client-, Datenbank- und Registrierungsteilen.
nocobase-app-upgrade
25kHilft deinem Agenten, eine NocoBase-App auf eine neuere Vorlagenversion zu aktualisieren, Vorlagenänderungen zu übernehmen und deine eigenen Arbeiten zu behalten.
Ähnliche Skills
reverse-engineer-anything
422kHilft deinem Agenten, fertige Apps und Pakete zu untersuchen, um Funktionen zu erklären, Versionen zu vergleichen oder einen Nachbau zu leiten, mit dem REA-Tool.
1password
394kHilft deinem Agenten, die 1Password-Kommandozeile einzurichten, sich anzumelden und Geheimnisse zu lesen oder einzufügen, ohne deren Werte im Chat auszugeben.
healthcheck
394kHilft deinem Agenten, den Computer oder Server, auf dem OpenClaw läuft, auf Sicherheitsrisiken wie SSH, Firewall, Updates und Backups zu prüfen und sichere Korrekturen vorzuschlagen.