nocobase-app-plugin-authz-sharing-rules
Fungsinya
Skill ini mengatur aturan berbagi untuk aksi bisnis NocoBase 3. Cocok untuk administrator yang perlu membagikan record tertentu kepada orang lain untuk sebuah kolaborasi.
Kapan dipakai
- ✓Saat satu orang perlu membagikan record tertentu kepada orang atau departemen lain.
- ✓Saat sebuah departemen memerlukan akses ke record dari departemen lain untuk tugas tertentu.
- ✓Saat Anda perlu memeriksa atau mengelola aturan berbagi di produksi.
Link skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-sharing-rules/skills/nocobase-app-plugin-authz-sharing-rules/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Bisakah Anda membiarkan tim keuangan melihat tiga proyek ini selain akses biasa mereka?”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
AI membuat aturan berbagi yang menambahkan record terpilih untuk orang atau departemen yang tercantum. Aturan ini hanya berlaku bagi orang yang sudah memiliki aksi tersebut, dan tidak bisa memilih semua record.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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(
Pertanyaan umum
Apakah berbagi memberi izin baru?
Tidak. Berbagi hanya menambahkan record bagi orang yang sudah memiliki aksi tersebut.
Bisakah saya membagikan semua record sekaligus?
Tidak. Berbagi tidak bisa memilih semua record.
Bagaimana hubungannya dengan aturan pembatasan?
Aturan pembatasan tetap berlaku setelahnya dan bisa mempersempit hasilnya.
Detail
Deskripsi asli dari pembuat
Design, implement and verify sharing rules for NocoBase 3 business operations, including named data scopes and production administration.
repo: nocobase/nocobase
Popularitas
- Bintang GitHub
- 25k
- Peringkat
- #10093
- Lisensi
- —
- Diperbarui
- 2/11/2026
Komentar
- …
Skill lain dari repositori ini
nocobase-app-development
25kMembantu agent Anda membangun halaman, rute, data, izin, dan tes untuk aplikasi bisnis NocoBase 3 yang lengkap.
shadcn
25kMembantu agent Anda menemukan, menambahkan, memperbaiki, dan memberi gaya komponen shadcn/ui pada proyek web, dengan memakai dokumentasi resmi dan registry-nya.
nocobase-app-plugin-development
25kMembantu agent Anda membuat dan memelihara plugin NocoBase 3 di dalam aplikasi yang sudah ada, mencakup bagian server, klien, database, dan registrasi.
nocobase-app-upgrade
25kMembantu agent Anda meningkatkan aplikasi NocoBase ke rilis template yang lebih baru, membawa perubahan template sambil tetap mempertahankan pekerjaan Anda sendiri.
Skill serupa
reverse-engineer-anything
422kMembantu agent Anda memeriksa aplikasi dan paket yang sudah dirilis untuk menjelaskan fitur, membandingkan versi, atau memandu pembangunan ulang dengan alat REA.
1password
394kMembantu agent Anda mengatur CLI 1Password, masuk, serta membaca atau menyisipkan rahasia tanpa menampilkan nilainya di chat.
healthcheck
394kMembantu agent Anda mengaudit komputer atau server OpenClaw dari risiko keamanan seperti SSH, firewall, pembaruan, dan cadangan, lalu menyarankan perbaikan aman.