Implements Orchard Core permission providers: static Permissions classes, IPermissionProvider pattern, localized descriptions, dynamic permissions via PermissionTemplate, and handling removed obsolete members.
Ships in orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an Orchard Core expert. Generate permission-provider code that follows Orchard Core conventions and CrestApps project structure.
static readonly fields of a static *Permissions class (for example TeamPermissions) in the feature's *.Core or *.Abstractions project, so other modules can reference them without depending on the module.internal sealed class PermissionProvider : IPermissionProvider in the module project that only lists the permissions and stereotypes.LocalizationSource.Create("...", typeof(DeclaringType)) (namespace OrchardCore.Localization). The type is the PO translation context.services.AddPermissionProvider<PermissionProvider>() (it uses TryAddEnumerable, so double registration is harmless).OrchardCoreConstants.Roles.Administrator instead of hard-coded "Administrator".isSecurityCritical: true.impliedBy) so a broader permission grants the narrower one.*.Core project too; keep the module focused on Startup, drivers, controllers, and views.src/Core/{{FeatureName}}.Core/Permissions/{{FeatureName}}Permissions.cssrc/Core/{{FeatureName}}.Core/Models/{{ContentPart}}.cssrc/Modules/{{FeatureName}}/PermissionProvider.cssrc/Modules/{{FeatureName}}/Startup.csusing OrchardCore.Localization;
using OrchardCore.Security.Permissions;
namespace CrestApps.Sports.Teams.Core.Permissions;
public static class TeamPermissions
{
public static readonly Permission ManageTeams = new(
"ManageTeams",
LocalizationSource.Create("Manage teams", typeof(TeamPermissions)),
isSecurityCritical: true);
public static readonly Permission ViewTeams = new(
"ViewTeams",
LocalizationSource.Create("View teams", typeof(TeamPermissions)),
[ManageTeams]);
}
Use typeof() here: a static class cannot be the T of LocalizationSource.Create<T>(). The constructors taking a plain string description (new Permission("ManageTeams", "Manage teams")) are [Obsolete] (CS0618) since Orchard Core 4.0; they create a context-free source that is translated only through Data Localization, not PO files.
using CrestApps.Sports.Teams.Core.Permissions;
using OrchardCore;
using OrchardCore.Security.Permissions;
namespace CrestApps.Sports.Teams;
internal sealed class PermissionProvider : IPermissionProvider
{
private readonly IEnumerable<Permission> _allPermissions =
[
TeamPermissions.ManageTeams,
TeamPermissions.ViewTeams,
];
public Task<IEnumerable<Permission>> GetPermissionsAsync()
=> Task.FromResult(_allPermissions);
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
new PermissionStereotype
{
Name = "Coach",
Permissions =
[
TeamPermissions.ViewTeams,
],
},
];
}
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;
namespace CrestApps.Sports.Teams;
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddPermissionProvider<PermissionProvider>();
}
}
Default stereotypes are granted to the roles of the same name when the feature is installed (first enabled), and to a role when it is created, for the enabled features. A role created while an installed feature is disabled remembers that feature, and gets its stereotype permissions when the feature is enabled again. Since Orchard Core 4.0 this also works for internal providers: every installed but disabled feature is tracked when a role is created, and its providers are resolved when it is re-enabled (previously only features whose public types included an IPermissionProvider were tracked, so the stereotypes of an internal provider were never granted to such roles).
Permission.Description is a LocalizationSource, not a string. Show it with stringLocalizerFactory.Localize(permission.Description)?.Value ?? permission.Name, and read permission.Description?.Value for the original text. The roles editor and the admin menu and menu item permission pickers translate typed descriptions with PO files, using the type's full name as msgctxt:
msgctxt "CrestApps.Sports.Teams.Core.Permissions.TeamPermissions"
msgid "Manage teams"
msgstr "Gérer les équipes"
Permission.Description and PermissionTemplate.Description are [JsonIgnore]: a source is never serialized, so the description is not part of a permission's JSON (an API response or a cached permission carries Name, Category, ImpliedBy and IsSecurityCritical, not the description). Read descriptions from the permission providers in code.
Typed descriptions are not listed in Data Localization; context-free descriptions, permissions built from templates (for example "Edit Article"), and categories still are. orchardcore-localization-source covers the API, the Data Localization interaction, and migration in detail.
Declare the template of a family of dynamic permissions (one per team, role, content type...) as a PermissionTemplate, not as a Permission. A template is never listed by a provider or granted to a role; it only creates permissions:
using OrchardCore.Localization;
using OrchardCore.Security.Permissions;
namespace CrestApps.Sports.Teams.Core.Permissions;
public static class TeamPermissionTemplates
{
private static readonly PermissionTemplate s_manageTeam = new(
"ManageTeam_{0}",
LocalizationSource.Create("Manage team {0}", typeof(TeamPermissionTemplates)),
TeamPermissions.ManageTeams);
public static Permission CreateManageTeamPermission(string teamName, string teamDisplayName) =>
s_manageTeam.CreateDynamicPermission(teamName, teamDisplayName);
}
PermissionTemplate(name, description, category = null, params Permission[] impliedBy) and PermissionTemplate(name, description, params Permission[] impliedBy). Name, the description value and Category use {0}; Category can also use {1} for the description value.CreateDynamicPermission(nameValue) uses the same value for both; CreateDynamicPermission(nameValue, descriptionValue) formats Name with the first value and Description.Value with the second.ImpliedBy lists static permissions; the init-only ImpliedByTemplates lists other templates, created with the same values, for example "Edit own {0}" implied by "Edit {0} for others". Set IsSecurityCritical with an object initializer.LocalizationSource.Create(formattedText) without a type, so it is translated through Data Localization, not PO files. Data Localization skips values that still contain {0}.ConcurrentDictionary) when they are requested often, as IndexingPermissions.CreateDynamicPermission(indexProfile) does.Content type permissions use the same model: ContentTypePermissionsHelper.PermissionTemplates (namespace OrchardCore.Contents.Security) is a Dictionary<string, PermissionTemplate> keyed by the global permission name. Use ContentTypePermissionsHelper.CreateDynamicPermissionOf(CommonPermissions.EditContent, typeDefinition), or its (string basePermissionName, ContentTypeDefinition) and (string basePermissionName, string contentType) overloads, and GetPermissionTemplate(name).
When a content part model is reused by services or other projects, move it into the matching *.Core project:
using OrchardCore.ContentManagement;
namespace CrestApps.Sports.Teams.Core.Models;
public sealed class TeamPart : ContentPart
{
public string AgeGroup { get; set; }
public string Level { get; set; }
}
The feature project should reference the core project and use that shared model from drivers, services, and startup wiring.
Permission.Description changed from string to LocalizationSource. Replace permission.Description string usage with permission.Description.Value (raw text) or IStringLocalizerFactory.Localize(permission.Description) (translated), and create descriptions with LocalizationSource.Create("...", typeof(MyPermissions)). Modules compiled against 3.x must be recompiled. See orchardcore-localization-source.[Obsolete] permission members were removed. Build on the latest 3.x, fix every CS0618 warning, then upgrade. Stored role claims use the same permission names, so no data migration is needed. Common replacements:
OrchardCore.Users.CommonPermissions.* becomes OrchardCore.Users.UsersPermissions.*OrchardCore.Deployment.CommonPermissions.* becomes OrchardCore.Deployment.DeploymentPermissions.*OrchardCore.Apis.GraphQL.CommonPermissions.* becomes OrchardCore.Apis.GraphQL.GraphQLPermissions.*OrchardCore.Media.Permissions.* and SecureMediaPermissions.* become OrchardCore.Media.MediaPermissions.*OrchardCore.Workflows.Permissions.* becomes OrchardCore.Workflows.WorkflowsPermissions.*OrchardCore.Settings.Permissions.* becomes OrchardCore.Settings.SettingsPermissions.*OrchardCore.ReCaptcha.Permissions.ManageReCaptchaSettings becomes OrchardCore.ReCaptcha.ReCaptchaPermissions.ManageReCaptchaSettingsOrchardCore.Security.StandardPermissions.SiteOwner is gone; assign users to the Administrator system role instead.references/permission-provider-examples.md for the full table.AdminMenu.Permissions.ManageAdminMenu and ViewAdminMenuAll were swapped; use AdminMenuPermissions.ManageAdminMenu and AdminMenuPermissions.ViewAdminMenuAll and re-check what each call site intends.CommonPermissions.CreateAssignRoleToUsersPermission(role) actually returned the edit-users-in-role permission. UsersPermissions.CreateAssignRoleToUsersPermission(role) now returns the real assign-role permission, so code relying on the old behavior must use UsersPermissions.CreateEditUsersInRolePermission(role).OrchardCore.Workflows.Permissions are still registered; only their static members were removed.Permission(string name, string description, ...) constructors are [Obsolete]. Pass LocalizationSource.Create("...", typeof(MyPermissions)).Permission (for example new("ManageTeam_{0}", "Manage team {0}", [...])) and formatted by hand become PermissionTemplate fields and CreateDynamicPermission(...) calls.ContentTypePermissionsHelper.PermissionTemplates values are PermissionTemplate instead of Permission. CreateDynamicPermission(Permission template, ContentTypeDefinition), CreateDynamicPermission(Permission template, string contentType) and ConvertToDynamicPermission(Permission) are [Obsolete]; use CreateDynamicPermissionOf(...) and GetPermissionTemplate(...).DeploymentStep.Category and Title are also LocalizationSource now, exposed as read-only virtual properties that a step overrides (see orchardcore-deployments).What SKILL.md sets; muted values are Claude Code's defaults
/orchardcore:orchardcore-permission-providersfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcore140 skills in this plugin
/orchardcore-adminGuidance for the Orchard Core admin panel, including admin controllers and routes, admin menu registration with AdminNavigationProvider, ocat editor forms grouped in cards, admin pages rendering Model.Editor, the UI text casing standard, TheAdmin layout and menu colors, admin branding, the Navbar shape, the Ctrl+K quick navigation palette and QuickNavigationSource, AdminSettings such as MenuBehavior, ShowBreadcrumb, DisplayQuickNavigation, DisplayTitlesInTopbar and ActionsLayout, the AdminDashboard shape, settings pages, and admin filters and zones. Use this skill when requests mention the Orchard Core admin panel, TheAdmin, admin controllers, admin menu registration, an icon on an admin menu item, the AdminSettings recipe step, quick navigation, navigation menu behavior, the admin URL prefix, UI text casing. Strong matches include OrchardCore.Admin, AdminSettings, AdminPermissions, AdminOptions, AdminAttribute, SiteDisplayDriver, IDisplayManager./orchardcore-admin-dashboardSkill for creating admin dashboard widgets in Orchard Core. Covers the DashboardWidget stereotype, DashboardPart position and sizing, the built-in HtmlDashboardWidget, ContentsMetadata and ContentsTags widget types, custom widget content types via recipe or migration, arranging widgets in Manage Dashboard mode, widget template customization, provisioning widgets with recipes, dashboard permissions, the DashboardBreadcrumbProvider Dashboard ancestor, and the AdminDashboardContent shape used when the feature is disabled. Use this skill when requests mention Orchard Core Admin Dashboard, Create and Configure Dashboard Widgets, Enabling Admin Dashboard, Widget Configuration Properties, dashboard widget recipes, Dashboard breadcrumb, or related implementation, setup, or troubleshooting work. Strong matches include OrchardCore.AdminDashboard, DashboardPart, DashboardBreadcrumbProvider, AccessAdminDashboard, ManageAdminDashboard./orchardcore-admin-edit-viewsSkill for writing Orchard Core admin editor views with the ocat CSS classes and cards. Covers Edit views for content parts and fields, field editor variants, part, field and site settings editors, Fields.Edit views, admin pages rendering Model.Editor built with IDisplayManager, the ocat classes and their layout rules, label associations and group captions, part and field wrapper classes, validation, hints and the Hint_Admin shape, cards declared in placement and the Card and CardContainer shapes, split editor shapes, tabs and columns, the edit page action bar, the horizontal form layout, and the UI text casing standard. Use this skill when requests mention Orchard Core admin edit views, admin forms, grouping fields in cards, Edit.cshtml, Fields.Edit.cshtml, Settings.Edit.cshtml, ocat classes, label casing, or field hints. Strong matches include ocat-wrapper, ocat-card, Hint_Admin, PlacementLocationBuilder, IDisplayManager, ContentPartDisplayDriver, SiteDisplayDriver./orchardcore-admin-listsSkill for Orchard Core 4.0 admin index views (list pages) rendered with the AdminList shape. Covers the List and Grid layouts, AdminListContext of TModel, the admin-list and admin-list-column tag helpers, column width and alignment, row display drivers placing shapes for SummaryAdmin and SummaryAdminGrid, row templates and zones, AdminListActions Buttons and Menu layouts, AdminListToolbar, AdminListSearch, the list-management script for select-all and bulk actions, IAdminListColumnsProvider, AdminListOptions, user layout selection, per-list alternates, sortable lists, and upgrading overridden list views. Use this skill when requests mention Orchard Core admin index views, an admin index page, admin lists, converting a hand-written admin listing, grid layout, list columns, row actions menu, or adding a column to the content items list. Strong matches include OrchardCore.Admin.Abstractions, AdminListContext, AdminListColumn, IAdminListColumnsProvider, AdminListOptions, AdminListLayout, ContentsAdminList./orchardcore-admin-menuSkill for creating admin menus in Orchard Core. Covers admin menu content, the link, placeholder, content types, and lists admin node types, the AdminMenu recipe and deployment step, ManageAdminMenu, ViewAdminMenuAll and per-menu ViewAdminMenu permissions from AdminMenuPermissions, custom admin nodes with AdminNode, IAdminNodeNavigationBuilder and AddAdminNode, data localization of node text, rendering in the 4.0 TheAdmin menu, and upgrading from the removed legacy admin menu layout. Use this skill when requests mention Orchard Core Admin Menu, Create and Manage Admin Menus, Admin Menu Deployment Recipe Step, Built-In Admin Node Types, Custom Admin Node Class, LegacyAdminMenuNavigation, or related implementation, setup, or troubleshooting work. Strong matches include OrchardCore.AdminMenu, OrchardCore.AdminMenu.Abstractions, AdminMenuPermissions, LinkAdminNode, PlaceholderAdminNode, OrchardCore.Lists, OrchardCore.Navigation./orchardcore-admin-schemesSkill for the Orchard Core 4.0 TheAdmin redesign and its admin schemes. Covers scheme records with their four colors, typography, density, corners, horizontal form layout and content width, Design > Themes > Schemes, the default scheme, the per-user scheme picker and its cookie, the seven built-in schemes, the AdminSchemes recipe step and Admin Schemes deployment step, the schemes.css stylesheet, the --ta-* design tokens, ta-content-fluid, dark mode utilities and nested color modes, TheOldAdmin and how to switch to it, and the breaking changes for custom admin themes and Layout overrides. Use this skill when requests mention admin schemes, admin colors, rebranding TheAdmin, dark mode of the admin, the admin content width, the horizontal form layout, TheOldAdmin, or upgrading a custom admin theme to the new TheAdmin. Strong matches include AdminScheme, AdminSchemes, DefaultSchemeId, HorizontalFormLayout, ContentWidth, data-ta-scheme, --ta-primary, ta-content-fluid, TheOldAdmin, and OrchardCore.Themes.TheAdmin.Other plugins' skills for the same job