Skip to content
agent-cms

Components / cms-roles

Roles

Roles with what they may do per collection (write, publish, delete, HTML), templates to start from, and the people in them, found by name or email.

With the shadcn CLI

npx shadcn add https://agent-cms-docs.vercel.app/r/cms-roles.json

With the agent-cms CLI

npx @mainsoft/agent-cms add cms-roles

No live demo: roles decide who may write, and the demo is shared by every visitor. Add the screen to your app, or run the example app (examples/next). Open the editor demo

Usage#

tsx
// app/admin/roles/page.tsx
"use client";
import { CmsRoles } from "@/components/cms/cms-roles";

export default function Page() {
  return <CmsRoles />;
}

The sidebar shows "Roles" to admins. Each role has a table with one row per collection and a box for Write, Publish and Delete; an operation the collection decides in code shows "Set in code". An admin role hides the table: it may do everything. People are found by name when the app passes createCms({ users }), and added by id without it.

See Automations, roles and the dashboard.

note

From 0.13.0.