webiny-admin-permissions
ما الذي تفعله
ترشد هذه المهارة ذكاءك عند إضافة ضوابط الصلاحيات إلى واجهة إدارة Webiny. وهي لمطورين يحتاجون إلى تقييد ما يستطيع المستخدمون رؤيته أو فعله في لوحة الإدارة.
متى تستخدمها
- ✓عندما تحتاج إلى إضافة إعدادات صلاحيات إلى ميزة إدارة في Webiny.
- ✓عندما تريد نموذج صلاحيات يُولَّد من مخطط بدلًا من كتابته يدويًا.
- ✓عندما يجب أن يظهر جزء من شاشة الإدارة أو يختفي حسب صلاحيات المستخدم.
رابط المهارة
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/admin-permissions/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أضف ضوابط صلاحيات لقسم المنتجات في إدارة Webiny، مع قواعد منفصلة للتعديل والاستيراد.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تشرح المهارة كيفية تعريف مخطط صلاحيات يولّد نموذج الصلاحيات. وتغطي أيضًا فحوص الصلاحيات القابلة للحقن، والمكوّن الذي يُظهر أجزاء الواجهة أو يخفيها.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
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
الأسئلة الشائعة
ماذا يعرّف مخطط الصلاحيات؟
يعرّف الكيانات وإجراءاتها ونطاقاتها، ويُولَّد نموذج الإدارة منه.
كيف تُفحص الصلاحيات في الكود؟
تصف المهارة فحوص الصلاحيات القابلة للحقن وhook مُكتوب النوع للمكوّنات.
هل تغطي الجانب الخادم أيضًا؟
تركز المهارة على واجهة الإدارة وفحص الصلاحيات في تلك الطبقة.
التفاصيل
الوصف الأصلي من المؤلف
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
الشعبية
- نجوم GitHub
- 8.1k
- الترتيب
- #12575
- الترخيص
- —
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
prd-to-plan
8.1kيساعد وكيلك على تحويل وثيقة متطلبات منتج إلى خطة مرحلية من شرائح صغيرة متكاملة من البداية إلى النهاية، تُحفظ كملف Markdown.
webiny-admin-architect
8.1kيعلّم وكيلك بناء شاشات الإدارة لمنصة Webiny، باستخدام طبقات منطق العمل وأسلوب الـpresenter.
webiny-form-model
8.1kيعلّم وكيلك بناء النماذج في Webiny باستخدام منشئ حقول تصريحي، مع التخطيطات والتحقق والقواعد الشرطية.
webiny-new-entry-wizard
8.1kيعلّم وكيلك إضافة معالج إعداد مخصص لإدخالات CMS الجديدة في Webiny، يجمع حقولًا قليلة أولًا، ثم يملأ نموذج الإدخال مسبقًا.
مهارات مشابهة
angular-developer
280kيساعد وكيلك على كتابة شيفرة Angular وتقديم نصائح لبنية المشروع، ويفيد في بدء المشاريع الجديدة وإنشاء المكونات وتحسين الأداء وإمكانية الوصول.
frontend-a11y
280kيساعد وكيلك على جعل واجهات الويب متاحة للجميع، فيضمن أن المواقع والتطبيقات تعمل جيدًا مع قارئات الشاشة والتنقل بلوحة المفاتيح.
frontend-patterns
280kيطبّق وكيلك أنماط تطوير الواجهات الحديثة، فيحسّن الأداء ويدير الحالة ويتبع أفضل الممارسات في React وNext.js.