Zum Inhalt springen
Skillpedia
Sicherheit25k · #10091

nocobase-app-plugin-authz-default-access

Was er macht

Dieser Skill konfiguriert den Standardzugriff auf Geschäftsaktionen in NocoBase 3 und legt so eine gemeinsame Basis an Datensätzen fest. Er ist für Administratoren und Entwickler, die die Sichtbarkeit von Datensätzen verwalten.

Wann du ihn nutzt

  • ✓Wenn alle mit einer bestimmten Aktion standardmäßig eine gemeinsame Menge von Datensätzen sehen sollen.
  • ✓Wenn du eine abteilungsweite Basis zum Lesen, aber nicht zum Bearbeiten von Datensätzen willst.
  • ✓Wenn du den Standardzugriff in der Produktivumgebung prüfen oder verwalten musst.

Link zum Skill

https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-default-access/skills/nocobase-app-plugin-authz-default-access/SKILL.md

Kopiere 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

Nutze diesen Skill, um mir zu helfen: https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-default-access/skills/nocobase-app-plugin-authz-default-access/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Kannst du es so einrichten, dass jeder Vertriebsnutzer standardmäßig alle offenen Leads lesen kann, das Bearbeiten aber auf den Eigentümer beschränkt bleibt?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Die KI setzt für eine Operation einen Standard-Datenbereich. Sie vergibt nicht die Aktion selbst, und andere Regeln engen die Ergebnisse weiter ein.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Develop default access

Default access adds a shared record baseline for every identity that already holds an action. It does not grant the action, page access or additional fields. A baseline combines with permission-set data scopes and sharing, and restriction rules still narrow the result, so choose it as an intentional minimum range rather than a fallback for identities without a scope of their own.

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-default-access/README.md is the complete reference for the service, the HTTP routes and the exports; this Skill covers how to use them.

For a department-scoped baseline, read the application development Skill's references/organization/permission-design.md first. Its core works with permission sets alone, and its optional default-access section explains why a global default suits a department scope only when everyone holding the action belongs to a department.

Development workflow

  1. Identify which records every holder of a particular operation should receive by default. A read baseline can be broad while edit remains preparer-only; do not copy read defaults into write operations.
  2. Confirm the composite, action and data scope exist and that the scope's grants target the intended collection. Reuse an applicable record access or define one through the main authorization Skill.
  3. Save one rule per resource under a stable key; a second rule on the same resource is rejected, so extend the existing rule instead. A rule lists every action and data scope it widens; updating it replaces the whole rule, and deleting it removes the baseline, not the permission-set action.
  4. Verify a holder receives the baseline, a person without the action remains denied, and restrictions still remove excluded rows. Also verify an explicit narrow data scope is not unexpectedly broadened by a permissive default.

For example, a quote view baseline can follow related-project ownership while editing follows the preparer, and a job's permission set can separately grant broad viewing that confidentiality restrictions narrow. A project's owner is not necessarily the author of every quote on that project.

Install

Register the default export of @nocobase/app-plugin-authz-default-access/client in client/plugins.ts and of @nocobase/app-plugin-authz-default-access/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 { defaultAccess } from '@nocobase/app-plugin-authz-default-access/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: [defaultAccess()] }),
);
export default authorization;

During setup the factory registers the settings item authorization.default-access (group authorization, actions read, create, update, delete) and its routes under /api/authorization/defaultAccess, 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 and sales.prepared its own record access, both defined as the main Skill describes.

import { selection } from '@nocobase/authorization/core';
import {
  defineDefaultAccessRule,
  type DefaultAccessAuthorizationApi,
} from '@nocobase/authorization/default-access';
import type { DatabaseConnection } from '@nocobase/db';

if (!('defaultAccess' in authz))
  throw new Error('Default access is not configured');
const rules = (
  authz as typeof authz & DefaultAccessAuthorizationApi<DatabaseConnection>
).defaultAccess;

await rules.create(
  defineDefaultAccessRule('quotes-baseline', quotes.reference())
    .scope('edit', 'quotes', selection.recordAccess('s
Häufige Fragen

Vergibt es neue Berechtigungen?

Nein. Es fügt eine gemeinsame Basis nur für Personen hinzu, die die Aktion bereits haben.

Können Einschränkungsregeln es überschreiben?

Einschränkungsregeln engen die Datensätze weiter ein, die der Standardzugriff erlaubt.

Deckt es auch Felder ab?

Nein. Es deckt die Datensätze ab, die eine Aktion erreichen kann, nicht zusätzliche Felder.

Details

Originalbeschreibung des Autors

Design, implement and verify default access for NocoBase 3 business operations, including named data scopes and production administration.

repo: nocobase/nocobase

Beliebtheit

GitHub-Sterne
25k
Platz im Ranking
#10091
Lizenz
—
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills