nocobase-app-plugin-authz-restriction-rules
Skill này làm gì
Skill này thêm quy tắc hạn chế để thu hẹp các bản ghi mà một hành động có thể tiếp cận trong ứng dụng NocoBase 3. Skill dành cho quản trị viên cần giữ một số bản ghi nằm ngoài tầm với của một số người dùng.
Khi nào nên dùng
- ✓Khi một số nhóm không bao giờ được xem một số bản ghi nhất định, ví dụ các dự án bảo mật.
- ✓Khi một giới hạn cần áp dụng cho mọi đường truy cập tới một collection.
- ✓Khi bạn cần kiểm tra hoặc quản lý các quy tắc hạn chế hiện có 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-restriction-rules/skills/nocobase-app-plugin-authz-restriction-rules/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ể đảm bảo nhóm kỹ thuật không bao giờ xem được các dự án mật trong ứng dụng NocoBase của tôi không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI tạo một quy tắc lấy giao của các bản ghi mà hành động tiếp cận với tập được phép chọn, cho các chủ thể đã liệt kê. Quy tắc hạn chế chỉ thu hẹp quyền truy cập và không bao giờ cấp thêm quyền.
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 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
Câu hỏi thường gặp
Một quy tắc hạn chế có thể cấp quyền không?
Không. Nó chỉ thu hẹp những gì đã được phép.
Nhiều quy tắc có kết hợp với nhau không?
Có. Tất cả các hạn chế khớp đều được áp dụng cùng lúc.
Nó khác truy cập mặc định thế nào?
Truy cập mặc định đặt một nền tảng chung, còn quy tắc hạn chế thu hẹp những gì mọi người có thể tiếp cận.
Chi tiết
Mô tả gốc của tác giả
Design, implement and verify restriction rules 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
- #10092
- 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.