Implements role-based content access control in Orchard Core using the CrestApps Content Access Control module. Covers RolePickerPart, restricting read permissions by role, SQL filtering with ContentAccessRoleIndex, and keeping restricted items out of AI knowledge bases.
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. Content Access Control (CrestApps.OrchardCore.ContentAccessControl) restricts who may read individual content items. It adds a Restrict content? setting to each RolePickerPart attached to a content type; when it is on, the roles picked on an item decide who may view, preview and list that item.
CrestApps.OrchardCore.ContentAccessControl in the web or startup project and enable the feature. It depends on CrestApps.OrchardCore.Roles (Enhanced Roles), which provides RolePickerPart; see the orchardcore-crestapps-roles skill.RolePickerPart to the type first; Restrict content? appears in that part's settings.ContentItem resource is affected: ViewContent, ViewOwnContent, PreviewContent, PreviewOwnContent and ListContent, and a securable type's own versions (ViewContent_Handbook), matched by name. Edit, publish and delete checks are not.Administrator (who sees everything anyway) with RolePickerPartSettings.ExcludedRoles.IAuthorizationService.AuthorizeAsync(user, CommonPermissions.ViewContent, contentItem) is not protected; authorize every item you render, or filter the query with ContentAccessRoleIndex.ContentAccessRoles (CrestApps.OrchardCore.Roles.Core: GetReaderRoles, IsInAnyRole, SeesEverything) in custom filters so they match the handler.CrestApps.OrchardCore.Recipes for schema support of RolePickerPartContentAccessControlSettings.| Item | Value |
|---|---|
| Feature ID | CrestApps.OrchardCore.ContentAccessControl (category Content Management) |
| Dependency | CrestApps.OrchardCore.Roles |
| Authorization handler | RoleBasedContentItemAuthorizationHandler (scoped IAuthorizationHandler for PermissionRequirement) |
| Settings driver | RolePickerPartContentAccessControlSettingsDisplayDriver (adds Restrict content?) |
| Settings model | RolePickerPartContentAccessControlSettings.IsContentRestricted (namespace CrestApps.OrchardCore.Roles.Core.Models) |
| Recipe schema | RolePickerPartContentAccessControlSchemaDefinition, registered when CrestApps.OrchardCore.Recipes is enabled |
| Index | ContentAccessRoleIndex (CrestApps.OrchardCore.Roles.Core.Indexes: ContentItemId, ContentType, RoleName), scoped provider ContentAccessRoleIndexProvider, .ExclusiveToDocumentType() only (several rows per item) |
| AI visibility | ContentAccessIndexedDocumentVisibility (IIndexedDocumentVisibility) |
| Constants | ContentAccessControlConstants.Feature, ContentAccessControlConstants.RolesFeature (CrestApps.OrchardCore.Roles.Core) |
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.ContentAccessControl"
],
"disable": []
}
]
}
For a reading permission checked on a ContentItem, RoleBasedContentItemAuthorizationHandler:
Administrator role (ContentAccessRoles.SeesEverything), so administrators see every item.RolePickerPart attachment (named or unnamed) whose IsContentRestricted is true.ContentAccessRoles.IsInAnyRole, which treats Authenticated as any signed-in user and Anonymous as a visitor), succeeds a view permission (ViewContent or ViewContent_{Type}); listing and previewing still need their own permission.Role names are compared case insensitively. Roles from several restricted attachments are combined. An item restricted to Authenticated opens for every signed-in user, to Anonymous only for visitors, and to both for everyone.
On the item editor, a restricting picker is labelled Which roles can see this content (unless the part has a display name of its own), shows Any role while none is picked, and hints Leave empty so everyone can see it. (unless the part has a hint).
using CrestApps.OrchardCore.Roles.Core.Models;
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.Data.Migration;
namespace MyModule.Migrations;
public sealed class MembersArticleMigrations : DataMigration
{
private readonly IContentDefinitionManager _contentDefinitionManager;
public MembersArticleMigrations(IContentDefinitionManager contentDefinitionManager)
{
_contentDefinitionManager = contentDefinitionManager;
}
public async Task<int> CreateAsync()
{
await _contentDefinitionManager.AlterTypeDefinitionAsync("MembersArticle", type => type
.WithPart<RolePickerPart>(part => part
.WithSettings(new RolePickerPartContentAccessControlSettings
{
IsContentRestricted = true,
})
.WithSettings(new RolePickerPartSettings
{
AllowSelectMultiple = true,
Required = true,
Hint = "Select the roles that may view this article.",
ExcludedRoles = ["Administrator"],
})));
return 1;
}
}
Register it with services.AddDataMigration<MembersArticleMigrations>();. Without a display name, editors see the default label Which roles can see this content; the custom Hint replaces Leave empty so everyone can see it., which would contradict Required.
{
"steps": [
{
"name": "ContentDefinition",
"ContentTypes": [
{
"Name": "MembersArticle",
"DisplayName": "Members Article",
"Settings": {
"ContentTypeSettings": {
"Creatable": true,
"Listable": true,
"Draftable": true,
"Versionable": true
}
},
"ContentTypePartDefinitionRecords": [
{
"PartName": "TitlePart",
"Name": "TitlePart",
"Settings": {}
},
{
"PartName": "RolePickerPart",
"Name": "RolePickerPart",
"Settings": {
"RolePickerPartContentAccessControlSettings": {
"IsContentRestricted": true
},
"RolePickerPartSettings": {
"Required": true,
"AllowSelectMultiple": true,
"ExcludedRoles": [ "Administrator" ]
}
}
}
]
}
]
},
{
"name": "content",
"data": [
{
"ContentType": "MembersArticle",
"DisplayText": "Members update",
"Published": true,
"Latest": true,
"RolePickerPart": {
"RoleNames": [ "Member" ]
}
}
]
}
]
}
using Microsoft.AspNetCore.Authorization;
using OrchardCore.ContentManagement;
using OrchardCore.Contents;
namespace MyModule.Services;
public sealed class VisibleContentFilter
{
private readonly IAuthorizationService _authorizationService;
public VisibleContentFilter(IAuthorizationService authorizationService)
{
_authorizationService = authorizationService;
}
public async Task<IReadOnlyList<ContentItem>> FilterAsync(System.Security.Claims.ClaimsPrincipal user, IEnumerable<ContentItem> items)
{
var visible = new List<ContentItem>();
foreach (var item in items)
{
if (await _authorizationService.AuthorizeAsync(user, CommonPermissions.ViewContent, item))
{
visible.Add(item);
}
}
return visible;
}
}
Authorizing each item is fine for one page, but a list or search of a restricted type would load every item to drop the ones its reader can't open. ContentAccessRoleIndex holds a row per role allowed to read each published item of a restricted type; an item with no role picked gets two rows, Anonymous and Authenticated. Drafts and items of unrestricted types get no row. When the feature is first enabled, a deferred task indexes the published items restricted before, 100 at a time.
using CrestApps.OrchardCore.Roles.Core;
using CrestApps.OrchardCore.Roles.Core.Indexes;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Records;
using YesSql;
using YesSql.Services;
namespace MyModule.Services;
public sealed class MembersArticleQuery
{
private readonly ISession _session;
public MembersArticleQuery(ISession session)
{
_session = session;
}
public Task<IEnumerable<ContentItem>> ListVisibleAsync(System.Security.Claims.ClaimsPrincipal user)
{
var query = _session.Query<ContentItem, ContentItemIndex>(index => index.Published && index.ContentType == "MembersArticle");
if (!ContentAccessRoles.SeesEverything(user))
{
var roles = ContentAccessRoles.GetReaderRoles(user).ToArray();
query = query.Where(index => index.ContentItemId.IsIn<ContentAccessRoleIndex>(
row => row.ContentItemId,
row => row.RoleName.IsIn(roles)));
}
return query.OrderByDescending(index => index.PublishedUtc).Take(20).ListAsync();
}
}
Use it only for a type whose RolePickerPart restricts content: items of other types have no row and would never be found. The Knowledge Base filters the help center, its search and its suggestions this way. A module that relies on the index depends on ContentAccessControlConstants.Feature.
An AI data source built from a content index answers anyone allowed to use its profile, without this module's checks. ContentAccessIndexedDocumentVisibility (an IIndexedDocumentVisibility) makes the AI data source sync leave out every item whose allowed roles do not include Anonymous, and remove one restricted after it was indexed. Items with no role picked, and items of types without a restricting picker, stay in. See orchardcore-ai-data-sources.
Administrator role bypass the restriction.ViewContent.ExcludedRoles if you excluded them before, so editors can open an item to all signed-in users or to everyone.RolePickerPart, or the feature is disabled.ViewContent authorization check.ExcludedRoles.RolePickerPartContentAccessControlSettings: enable CrestApps.OrchardCore.Recipes.ContentAccessRoleIndex misses items: the type is not restricted (no rows), the items are drafts, or the backfill after enabling the feature has not finished.Anonymous among its roles, has no role picked, or the data source has not synced since.What SKILL.md sets; muted values are Claude Code's defaults
/crestapps-orchardcore:orchardcore-content-access-controlfrom 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./orchardcore-addressesSkill for the CrestApps Orchard Core Addresses module (CrestApps.OrchardCore.Addresses, Addresses.Countries, Addresses.GooglePlaces). Covers the immutable Address value shared by customers, checkout, orders, shipping and taxation, per-country address formats from Google address data with AddAddressesCore, IAddressFormatProvider and AddressFormat, IAddressValidator and AddressProblem, IAddressFormatter, the AddressEditor shape with IAddressEditorService and AddressEditorOptions, CreateAddressEditorAsync and CreateAddressDisplayAsync, ICountryService and managed Country content items, address suggestions through IAddressAutocompleteProvider, ContactInfo, NamedAddress and IShippingAddressBook, the Google Places provider with its protected API key, the address-autocomplete rate-limit group, and the ManageAddressSuggestions permission. Use it when requests mention Orchard Core addresses, international address formats, address validation, a country list, address autocomplete or Google Places./orchardcore-advanced-seoSkill for the CrestApps Orchard Core Advanced SEO module (CrestApps.OrchardCore.Seo), which publishes schema.org structured data as one JSON-LD graph per page and for NLWeb answers. Covers the Schema.org part (SchemaOrgPart, SchemaOrgPartSettings with SchemaType and property mappings from Content, Fixed, Editor or Liquid sources), the StructuredDataSettings site settings and their deployment step, the ManageAdvancedSeoSettings permission, Orchard Core SEO, Search, Products and Reviews integration, the getSchemaOrgOptions, configureContentTypeSchemaOrg and configureSiteStructuredData AI tools, describing pages in code with IPageStructuredData, the structured-data tag helper and the structured_data Liquid filter, and extending with IStructuredDataProvider, ContentPartStructuredDataProvider and SelfDescribingParts. Use this skill when requests mention schema.org, JSON-LD, structured data, rich results, Google required properties, product or article markup, or Advanced SEO in Orchard Core./orchardcore-agentic-commerceSkill for the CrestApps Orchard Core Agentic Commerce module (CrestApps.OrchardCore.AgenticCommerce), which lets AI agents such as Gemini and ChatGPT buy from the store with the Universal Commerce Protocol (UCP), the Agentic Commerce Protocol (ACP) and the AP2 mandates extension (preview). Covers every feature (UCP, account linking, catalog and cart, MCP and A2A bindings, ACP, Agent Product Feeds, AP2), the /.well-known/ucp and /.well-known/acp.json discovery documents, checkout session endpoints, agent platforms and their sign-in, AgenticCommerceSettings, store signing keys in Secrets, idempotency, payment handlers (Stripe shared payment tokens, Google Pay, test credentials), delegated 3-D Secure, embedded checkout, signed order updates, the AgentPlatforms recipe step, and extending with IAgentPaymentHandler, IUcpProfileContributor, IUcpCheckoutExtension and IAgentOrderPublisher. Use it when requests mention agentic commerce, selling through AI agents, UCP, ACP, AP2, agent checkout or agent product feeds./orchardcore-agreementsSkill for the CrestApps Orchard Core Agreements module (CrestApps.OrchardCore.Agreements), support and maintenance contracts with accounts. Covers the Agreement record with its SA- number, status, period and covered hours (a block or a monthly allowance with rounding), Content > Agreements, the account Service tab, the ManageAgreements and ViewAgreements permissions, the Agreements recipe and deployment step, module terms in Properties with IAgreementTermsValidator, IAgreementUsageProvider and IAgreementBalanceService, the hourly lifecycle task with IAgreementObserver, account manager notifications, and the Agreement Usage and Burn-down reports. Use this skill when requests mention service agreements, support contracts, prepaid or retainer hours, entitlements or agreement expiry. Strong matches include Agreement, AgreementHours, AgreementStatus, AgreementBalance, AgreementUsage, IAgreementManager, IAgreementObserver and TicketAgreementTerms.Other plugins' skills for the same job