webiny-admin-permissions
Skill này làm gì
Skill này hướng dẫn AI của bạn khi thêm kiểm soát quyền vào giao diện quản trị Webiny. Dành cho lập trình viên cần giới hạn những gì người dùng thấy hoặc làm được trong bảng quản trị.
Khi nào nên dùng
- ✓Khi bạn cần thêm thiết lập quyền vào một tính năng quản trị Webiny.
- ✓Khi bạn muốn form quyền được sinh từ một schema thay vì viết tay.
- ✓Khi một phần màn hình quản trị phải hiện hoặc ẩn tùy theo quyền của người dùng.
Liên kết skill
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/admin-permissions/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
“Thêm kiểm soát quyền cho phần sản phẩm trong quản trị Webiny, với quy tắc riêng cho chỉnh sửa và nhập dữ liệu.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill giải thích cách định nghĩa một schema quyền, từ đó sinh ra form quyền. Nó cũng bao phủ các kiểm tra quyền có thể inject và component để ẩn hoặc hiện các phần giao diệ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.
Admin Permissions
Overview
Permissions follow three layers: domain (schema), features (DI artifacts + registration), and presentation (hooks, components, UI config). The framework auto-generates the permission UI from a schema and provides injectable permission checking via the DI container.
Layer 1: Domain — Permission Schema
Define the schema in src/domain/permissionsSchema.ts:
import { createPermissionSchema } from "webiny/admin/security";
export const SM_PERMISSIONS_SCHEMA = createPermissionSchema({
prefix: "sm",
fullAccess: true,
entities: [
{
id: "product",
title: "Products",
permission: "sm.product",
scopes: ["full", "own"],
actions: [
{ name: "rwd" },
{ name: "pw" },
{ name: "import", label: "Import products" },
{ name: "export", label: "Export products" }
]
},
{
id: "category",
title: "Categories",
permission: "sm.category",
scopes: ["full"],
actions: [{ name: "rwd" }]
},
{
id: "settings",
title: "Settings",
permission: "sm.settings",
scopes: ["full"]
}
]
});
Schema Reference
| Field | Type | Required | Description |
|---|---|---|---|
prefix |
string |
Yes | Permission prefix (e.g., "sm") |
fullAccess |
true | object |
Yes | true for standard full access. Pass an object with custom boolean flags for full-access extras (e.g., { canForceUnlock: true }). |
readOnlyAccess |
boolean |
No | Whether to show a "Read-only access" option |
entities |
EntityDefinition[] |
No | Entity definitions. Omit for binary full/no access. |
Entity Definition
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | Unique identifier for form field naming |
title |
string |
No | Display title. Falls back to id. |
permission |
string |
Yes | Permission name emitted (e.g., "sm.product") |
scopes |
("full" | "own")[] |
Yes | Available access scopes |
actions |
ActionDefinition[] |
No | Actions on this entity |
dependsOn |
{ entity: string; requires: string } |
No | Dependency on another entity |
Actions
{ name: "rwd" }— Read/Write/Delete select dropdown. Auto-set to"rwd"when scope is"own".{ name: "pw" }— Publish/Unpublish checkbox group.{ name: "custom", label: "Label" }— Custom boolean flag.
Entity Dependencies
Child entities can depend on a parent. If the parent lacks the required action, the child is pruned from output. "own" scope cascades to dependents.
{
id: "review",
permission: "sm.review",
scopes: ["full", "own"],
actions: [{ name: "rwd" }],
dependsOn: { entity: "product", requires: "r" }
}
Simple Apps (No Entities)
Omit entities for binary full/no access:
export const MA_PERMISSIONS_SCHEMA = createPermissionSchema({
prefix: "ma",
fullAccess: true
});
Layer 2: Features — DI Artifacts + Registration
Abstraction (src/features/permissions/abstractions.ts)
import { createPermissionsAbstraction } from "webiny/admin/security";
import type { Permissions } from "webiny/admin/security";
import { SM_PERMISSIONS_SCHEMA } from "~/domain/permissionsSchema.js";
export const SmPermissions = createPermissionsAbstraction(SM_PERMISSIONS_SCHEMA);
export namespac
Câu hỏi thường gặp
Schema quyền làm gì?
Nó định nghĩa các entity, hành động và phạm vi của chúng, và form quản trị được sinh từ đó.
Quyền được kiểm tra trong mã thế nào?
Skill mô tả các kiểm tra quyền có thể inject và một hook có kiểu cho component.
Nó có bao gồm phía máy chủ không?
Skill tập trung vào giao diện người dùng quản trị và kiểm tra quyền ở tầng đó.
Chi tiết
Mô tả gốc của tác giả
Admin-side permission UI registration and DI-backed permission checking. Use this skill when adding permission controls to the admin UI — schema-based auto-generated forms, injectable permissions via createPermissionsAbstraction/ createPermissionsFeature, typed hooks (createUsePermissions), the HasPermission component (createHasPermission), and the Security.Permissions component props. Covers both simple apps and complex multi-entity permission schemas.
repo: webiny/webiny-js
Độ phổ biến
- Sao GitHub
- 8.1k
- Vị trí xếp hạng
- #12575
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
prd-to-plan
8.1kGiúp agent của bạn biến tài liệu yêu cầu sản phẩm thành kế hoạch theo giai đoạn gồm các lát cắt đầu-cuối nhỏ, lưu thành file Markdown.
webiny-admin-architect
8.1kDạy agent của bạn cách xây dựng màn hình quản trị cho nền tảng Webiny, dùng các tầng logic nghiệp vụ và mẫu presenter.
webiny-form-model
8.1kDạy agent của bạn xây dựng form trong Webiny bằng trình tạo trường khai báo, bố cục, kiểm tra hợp lệ và quy tắc có điều kiện.
webiny-new-entry-wizard
8.1kDạy agent của bạn thêm một wizard thiết lập tùy chỉnh cho mục CMS mới của Webiny, thu thập vài trường trước rồi điền sẵn form mục.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.