nocobase-app-plugin-authz-sharing-rules
できること
NocoBase 3の業務アクションに共有のルールを設定します。共同作業のために、特定のレコードを他の人と共有する必要がある管理者向けです。
使う場面
- ✓ある人が、特定のレコードを別の人や部署と共有する必要があるとき。
- ✓ある部署が、作業のために別の部署のレコードへのアクセスを必要とするとき。
- ✓本番環境で共有のルールを確認または管理する必要があるとき。
スキルのリンク
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-sharing-rules/skills/nocobase-app-plugin-authz-sharing-rules/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“財務チームが、通常のアクセスに加えてこの3つのプロジェクトを閲覧できるようにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIは、指定された人や部署に選ばれたレコードを追加する共有のルールを作成します。このルールは、すでにそのアクションを持つ人にだけ働き、すべてのレコードを選ぶことはできません。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Develop sharing rules
A sharing rule adds selected records, or a record access selection, for the subjects it lists, provided they already hold the action. Sharing does not grant the operation, fields, page access or related records, and it cannot select all records. Grants, default access and sharing combine first; restriction rules then narrow the result.
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-sharing-rules/README.md is the complete reference for the service, the HTTP routes and the exports; this Skill covers how to use them.
For sharing between departments, read the application development Skill's references/organization/permission-design.md first. A rule whose recipient is a department shares specific records with it; a viewer-relative department scope such as 本部门及下属部门 is computed for the viewer and cannot select another department's records. The guide's optional sharing section covers this plugin, and its core section says what remains with permission sets alone.
Development workflow
- Identify the real collaboration exception: who receives which records, for which actions, and why. Use explicit records for one handover; use a record access selection for a maintained region or team rule.
- Grant the recipients the business action through a permission set first. Register inherited subjects and their active membership resolver through the main authorization Skill.
- Inspect every data scope the operation requires. Quote submission needs the selected quote and its actual parent project. Add each action and data scope deliberately; view, edit and submit are different permissions.
- Save a complete rule through the HTTP routes or the service. Keep record ids tied to their data scope's collection and preserve the other entries on update.
- Verify the handover works, an unshared parent still blocks the workflow, restrictions still exclude confidential records, and sharing alone cannot activate a missing operation.
- Revoke the recipient or the team's permission set and verify the next request loses only that source. Independent direct-user sharing and direct assignments must survive.
For example, a quote handover shares quote edit and submit plus the parent project's submit scope with a delegated engineer. Use the real record ids, never sample ones.
Install
Register the default export of @nocobase/app-plugin-authz-sharing-rules/client in client/plugins.ts and of @nocobase/app-plugin-authz-sharing-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 { sharingRules } from '@nocobase/app-plugin-authz-sharing-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: [sharingRules()] }),
);
export default authorization;
During setup the factory registers the settings item authorization.sharing-rules (group authorization, actions read, create, update, delete) and its routes under /api/authorization/sharingRules, 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 org.team its own subject type, both defined as the main Skill describes.
import { selection } from '@nocobase/authorization/core';
import {
defineSharingRule,
type SharingRulesAuthorizationApi,
} from '@nocobase/authorization/sharing-rules';
import type { DatabaseConnection } from '@nocobase/db';
if (!('sharingRules' in authz))
throw new Error('Sharing rules is not configured');
const rules = (
authz as typeof authz & SharingRulesAuthorizationApi<DatabaseConnection>
).sharingRules;
await rules.create(
よくある質問
共有によって新しい権限が与えられますか?
いいえ。共有は、すでにそのアクションを持つ人にだけレコードを追加します。
すべてのレコードを一度に共有できますか?
いいえ。共有では、すべてのレコードを選ぶことはできません。
制限のルールとはどう組み合わさりますか?
制限のルールは後から適用され、結果をさらに絞り込むことがあります。
詳細
作者による元の説明
Design, implement and verify sharing rules for NocoBase 3 business operations, including named data scopes and production administration.
repo: nocobase/nocobase
人気
- GitHubのスター
- 25k
- ランキング
- #10093
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
nocobase-app-development
25kエージェントが、NocoBase 3の完全なビジネスアプリケーションのために、ページ、ルーティング、データ、権限、テストを作れるよう支援します。
shadcn
25kエージェントが、公式のドキュメントとレジストリを使い、Webプロジェクトの shadcn/uiコンポーネントを見つけ、追加し、修正し、スタイルを整えられるよう支援します。
nocobase-app-plugin-development
25kエージェントが、既存のNocoBase 3アプリの中で、サーバー、クライアント、データベース、登録の部分を含むプラグインを作成し、保守できるよう支援します。
nocobase-app-upgrade
25kエージェントが、NocoBaseのアプリを新しいテンプレートのリリースにアップグレードし、テンプレートの変更を取り込みつつ、あなた自身の作業を保てるよう支援します。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。