webiny-admin-permissions

Registers schema-based permission UI and DI-backed permission checking in Webiny admin apps.

8.0k|673|Updated Jan 9, 2018
One-click install
npx skills add https://github.com/webiny/webiny-js --skill webiny-admin-permissions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: webiny-admin-permissions
Source: https://github.com/webiny/webiny-js/tree/main/skills/user-skills/admin/admin-permissions
Command: npx skills add https://github.com/webiny/webiny-js --skill webiny-admin-permissions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building permission controls for a Webiny admin extension normally requires hand-writing forms, hooks, and access checks. This Skill shows how to define a single permission schema and let the framework auto-generate the permission UI, typed hooks, and injectable permission services.

Core Features & Use Cases

  • Schema-driven permission UI: Define entities, scopes, and actions with createPermissionSchema and render them via the Security.Permissions component.
  • DI-backed permission checking: Create injectable abstractions with createPermissionsAbstraction and createPermissionsFeature for use inside feature implementations.
  • Typed hooks and components: Use createUsePermissions and createHasPermission to gate UI rendering with fully typed entity and action checks.
  • Use Case: You are building a Store Manager admin app with products, categories, and settings. Define one schema, register the feature, and immediately get a permission accordion in the security UI plus canRead/canEdit/canPublish checks in your React components.

Quick Start

Ask the AI to add a permission schema with product and category entities to your Webiny admin extension and wire up the usePermissions hook and HasPermission component.

Frequently Asked Questions about webiny-admin-permissions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add permission controls to a Webiny admin app?

Define a schema with createPermissionSchema listing entities, scopes, and actions, then register it via the Security.Permissions component in your extension. The framework auto-generates the permission form UI from that schema.

How to check user permissions in Webiny React components?

Create a typed hook with createUsePermissions and call methods like canRead, canEdit, canPublish, or canAction with your entity IDs. Alternatively, wrap JSX in the HasPermission component created by createHasPermission to conditionally render content.

Does Webiny admin permissions support entity dependencies?

Yes, an entity can declare dependsOn with a parent entity and required action. If the parent lacks the required action, the child is pruned from the permission output, and the own scope cascades to dependents.

Can I use Webiny admin permissions for a simple app without entities?

Yes, omit the entities field from createPermissionSchema to get binary full-or-no access control. This suits simple apps that only need a single full access toggle rather than per-entity scopes and actions.

Why must admin and API permission schemas match in Webiny?

The admin UI emits permission values that the API evaluates, so both schemas must share the same prefix, entity IDs, and action names. Mismatched definitions cause permission checks to fail silently on the API side.