nocobase-app-plugin-authz-default-access
Skill này làm gì
Skill này cấu hình truy cập mặc định cho các hành động nghiệp vụ trong NocoBase 3, tạo ra một nền tảng bản ghi dùng chung. Skill dành cho quản trị viên và lập trình viên quản lý khả năng nhìn thấy bản ghi.
Khi nào nên dùng
- ✓Khi mọi người có một hành động nhất định nên thấy cùng một tập bản ghi theo mặc định.
- ✓Khi bạn muốn một nền tảng chung cho cả phòng ban để đọc bản ghi nhưng không để chỉnh sửa.
- ✓Khi bạn cần kiểm tra hoặc quản lý truy cập mặc định trong môi trường thực tế.
Liên kết skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-default-access/skills/nocobase-app-plugin-authz-default-access/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể cho mọi nhân viên bán hàng đọc được tất cả khách hàng tiềm năng đang mở theo mặc định, nhưng chỉ chủ sở hữu mới được chỉnh sửa không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI đặt một phạm vi dữ liệu mặc định cho một thao tác. Nó không cấp chính hành động đó, và các quy tắc khác vẫn thu hẹp kết quả.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
- 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.
- 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.
- 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. - 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
Câu hỏi thường gặp
Nó có cấp quyền mới không?
Không. Nó chỉ thêm nền tảng chung cho những người đã có hành động đó.
Các quy tắc hạn chế có ghi đè được nó không?
Các quy tắc hạn chế vẫn thu hẹp các bản ghi mà truy cập mặc định cho phép.
Nó có bao gồm cả trường không?
Không. Nó chỉ áp dụng cho các bản ghi mà hành động có thể tiếp cận, không áp dụng cho các trường bổ sung.
Chi tiết
Mô tả gốc của tác giả
Design, implement and verify default access for NocoBase 3 business operations, including named data scopes and production administration.
repo: nocobase/nocobase
Độ phổ biến
- Sao GitHub
- 25k
- Vị trí xếp hạng
- #10091
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
nocobase-app-development
25kGiúp agent của bạn xây dựng trang, tuyến, dữ liệu, quyền và kiểm thử cho một ứng dụng kinh doanh NocoBase 3 hoàn chỉnh.
shadcn
25kGiúp agent của bạn tìm, thêm, sửa và tạo kiểu cho các thành phần shadcn/ui trong dự án web, dùng tài liệu chính thức và registry của chúng.
nocobase-app-plugin-development
25kGiúp agent của bạn tạo và duy trì plugin NocoBase 3 trong một ứng dụng có sẵn, gồm phần server, client, cơ sở dữ liệu và đăng ký.
nocobase-app-upgrade
25kGiúp agent của bạn nâng cấp ứng dụng NocoBase lên bản mẫu mới hơn, mang các thay đổi của mẫu vào mà vẫn giữ công việc riêng của bạn.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.