Skip to content
Skillpedia
Websites & UI (frontend)8.1k · #12575

webiny-admin-permissions

What it does

This skill guides your AI when adding permission controls to the Webiny admin interface. It is for developers who need to limit what users can see or do in an admin panel.

When to use it

  • ✓When you need to add permission settings to a Webiny admin feature.
  • ✓When you want a permission form generated from a schema instead of written by hand.
  • ✓When a part of the admin screen must show or hide depending on the user's permissions.

Skill link

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/admin-permissions/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/admin-permissions/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Add permission controls for my products section in the Webiny admin, with separate rules for editing and importing.”

5 new skills a week. 1 minute to read.

How it works

The skill explains how to define a permission schema, which generates the permission form. It also covers the injectable permission checks and the component that shows or hides interface parts.

Technical content (original SKILL.md)

Original text by the author, straight from 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
FAQ

What does the permission schema do?

It defines entities, their actions and scopes, and the admin form is generated from it.

How are permissions checked in code?

The skill describes injectable permission checks and a typed hook for components.

Does it cover the server side too?

The skill focuses on the admin user interface and permission checking in that layer.

Details

Original description by the author

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

Popularity

GitHub stars
8.1k
Ranking position
#12575
License
—
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills