Adds role selection to Orchard Core content types via RolePickerPart with bootstrap-select editor, settings for required/single/multiple/excluded roles, and content-access filtering helpers.
Ships in crestapps-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.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Use the CrestApps Roles module when a content item must persist selected Orchard Core role names. RolePickerPart is a reusable content part with settings that control requiredness, selection cardinality, and which roles editors cannot select.
CrestApps.OrchardCore.Roles in the web or startup project.CrestApps.OrchardCore.Roles feature (Enhanced Roles). Its manifest depends on OrchardCore.Roles and OrchardCore.Resources.RolePickerPart; its stored value property is RoleNames.RolePickerPart as attachable and reusable (display name Role Picker, default position 999), so a type can attach it more than once under different names.RolePickerPart, RolePickerPartSettings and RolePickerPartContentAccessControlSettings live in CrestApps.OrchardCore.Roles.Core.Models.bootstrap-select dropdown with live search, plus select-all and deselect-all when multiple selection is allowed.RolePickerPartSettings only on a RolePickerPart content-type attachment, not on the reusable part definition or an unrelated field definition.AllowSelectMultiple to false for a single role. The display driver validates that at most one role was submitted.Required to true only when the item cannot be meaningful without a selected role.ExcludedRoles for built-in or sensitive roles that should never be selectable in this context.orchardcore-content-access-control skill), which builds on this part.RoleManager<IRole>, removes excluded names, and orders the choices.RolePickerPartContentAccessControlSettings.IsContentRestricted), the editor label defaults to Which roles can see this content, the empty text reads Any role and the hint defaults to Leave empty so everyone can see it.; a display name or hint set on the part attachment still wins. Other pickers use the part's display name as label and empty text.ContentAccessRoles and ContentAccessRoleIndex from CrestApps.OrchardCore.Roles.Core, never a per-item check over a large list.CrestApps.OrchardCore.Recipes when recipe JSON Schema support for settings and the RoleNames payload is needed.| Feature ID | Purpose |
|---|---|
CrestApps.OrchardCore.Roles | Registers RolePickerPart, drivers, and its data migration |
OrchardCore.Roles | Provides Orchard Core role management and identity role services |
OrchardCore.Resources | Registers the bootstrap-select script and style the editors use |
CrestApps.OrchardCore.Recipes | Activates RolePickerPartSchemaDefinition when combined with the Roles feature |
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Roles",
"CrestApps.OrchardCore.Recipes"
],
"disable": []
}
]
}
RolePickerPartSettings property | Admin label | Meaning |
|---|---|---|
ExcludedRoles | Exclude roles | Role names removed from the choices and stripped from the saved value |
Required | Required? | Requires at least one allowed selected role |
AllowSelectMultiple | Allow multiple? | Allows more than one role; when off, saving more than one fails validation |
Hint | Hint | Help text under the picker |
RolePickerPart.RoleNames is an array of role-name strings. Keep names aligned with role records managed through Orchard Core Roles.
using CrestApps.OrchardCore.Roles.Core.Models;
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.Data.Migration;
namespace MyModule;
public sealed class ProductMigrations : DataMigration
{
private readonly IContentDefinitionManager _contentDefinitionManager;
public ProductMigrations(IContentDefinitionManager contentDefinitionManager)
{
_contentDefinitionManager = contentDefinitionManager;
}
public async Task<int> CreateAsync()
{
await _contentDefinitionManager.AlterTypeDefinitionAsync("Product", type => type
.WithPart<RolePickerPart>(part => part
.WithDisplayName("Visible to roles")
.WithSettings(new RolePickerPartSettings
{
Required = true,
AllowSelectMultiple = true,
Hint = "Select the roles that can see this product.",
ExcludedRoles = ["Anonymous", "Authenticated"],
})));
return 1;
}
}
Register the migration from the owning module:
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Data.Migration;
using OrchardCore.Modules;
namespace MyModule;
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddDataMigration<ProductMigrations>();
}
}
The item editor strips excluded roles even if a stale form submission includes them. If single selection is configured, it also reports a model-state error when more than one allowed role is submitted.
With CrestApps Recipes enabled, the content-definition schema recognizes RolePickerPartSettings.
{
"steps": [
{
"name": "ContentDefinition",
"ContentTypes": [
{
"Name": "Product",
"ContentTypePartDefinitionRecords": [
{
"PartName": "RolePickerPart",
"Name": "RolePickerPart",
"Settings": {
"ContentTypePartSettings": {
"Position": "5"
},
"RolePickerPartSettings": {
"Required": true,
"AllowSelectMultiple": true,
"ExcludedRoles": [
"Anonymous",
"Authenticated"
],
"Hint": "Select allowed roles."
}
}
}
]
}
]
}
]
}
{
"steps": [
{
"name": "content",
"data": [
{
"ContentType": "Product",
"DisplayText": "Partner catalogue",
"RolePickerPart": {
"RoleNames": [
"Partner",
"Administrator"
]
}
}
]
}
]
}
The schema validates the shape only. Before importing, ensure each RoleNames value names a role that exists for the tenant. The content part does not create missing roles.
Use the part data from the loaded content item. Keep authorization decisions explicit rather than using an unvalidated content property as a permission check.
using CrestApps.OrchardCore.Roles.Core.Models;
using OrchardCore.ContentManagement;
namespace MyModule;
public sealed class ProductRoleReader
{
public IReadOnlyList<string> GetRoleNames(ContentItem product)
=> product.As<RolePickerPart>()?.RoleNames ?? [];
}
CrestApps.OrchardCore.Roles.Core (namespace CrestApps.OrchardCore.Roles.Core) holds the building blocks Content Access Control and modules such as Knowledge Base share:
| Member | Purpose |
|---|---|
ContentAccessRoles.GetReaderRoles(user) | Anonymous for a visitor; Authenticated plus the role claims for a signed-in user (Orchard Core never puts those two roles in claims) |
ContentAccessRoles.IsInAnyRole(user, roleNames) | Whether the reader holds any of the roles, Authenticated and Anonymous included |
ContentAccessRoles.SeesEverything(user) | true for the Administrator role; skip role filtering for them |
ContentAccessControlConstants.Feature / .RolesFeature | CrestApps.OrchardCore.ContentAccessControl / CrestApps.OrchardCore.Roles |
ContentAccessRoleIndex (.Indexes) | One row (ContentItemId, ContentType, RoleName) per picked role of each published item of a restricted type; an item with no role picked gets Anonymous and Authenticated rows. Drafts and unrestricted types get none |
The Content Access Control module owns the index provider and table (it declares .ExclusiveToDocumentType() only, since an item has one row per role); see orchardcore-content-access-control. Filter a published-item query in SQL:
using CrestApps.OrchardCore.Roles.Core;
using CrestApps.OrchardCore.Roles.Core.Indexes;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Records;
using System.Security.Claims;
using YesSql;
using YesSql.Services;
namespace MyModule.Services;
public sealed class RestrictedArticleQuery
{
private readonly ISession _session;
public RestrictedArticleQuery(ISession session)
{
_session = session;
}
public Task<IEnumerable<ContentItem>> ListAsync(ClaimsPrincipal reader)
{
var query = _session.Query<ContentItem, ContentItemIndex>(index => index.ContentType == "Article" && index.Published);
if (!ContentAccessRoles.SeesEverything(reader))
{
var roles = ContentAccessRoles.GetReaderRoles(reader).ToArray();
query = query.Where(index => index.ContentItemId.IsIn<ContentAccessRoleIndex>(
row => row.ContentItemId,
row => row.RoleName.IsIn(roles)));
}
return query.ListAsync();
}
}
crestapps-bootstrap-select resource. They request Orchard Core's bootstrap-select, and the module now depends on OrchardCore.Resources. Theme overrides of RolePickerPart.Edit.cshtml or RolePickerPartSettings.Edit.cshtml must switch to <style asp-name="bootstrap-select"> and <script asp-name="bootstrap-select" at="Foot">.CrestApps.OrchardCore.Roles and confirm OrchardCore.Roles is available.OrchardCore.Resources is enabled so bootstrap-select resolves.ExcludedRoles.RolePickerPartSettings recipe schema means the Roles and Recipes features were not enabled together.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, role-picker, content-parts, enhanced-roles, crestapps
/crestapps-orchardcore:orchardcore-crestapps-rolesfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job