Manages users, roles, and permissions in Orchard Core. Covers login, registration, external auth, permission checks, and configuration recipes.
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 code and configuration for user management, roles, and permissions.
OrchardCore.Users and OrchardCore.Roles for user and role management.*Permissions class and expose them through an IPermissionProvider (see orchardcore-permission-providers).LocalizationSource.Create("...", typeof(MyPermissions)).IAuthorizationService.AuthorizeAsync(User, permission) for permission checks and has_permission in Liquid.OrchardCore.Users.UsersPermissions and role permissions through OrchardCore.Roles.RolesPermissions.ILoginFormEvent, ILogoutFormEvent, IRegistrationFormEvents, and IPasswordRecoveryFormEvents.RegistrationOptions and ExternalLoginOptions through IOptionsMonitor<T>.CurrentValue; they refresh when site settings change.OrchardCore.RateLimits to throttle login, registration, password recovery, and confirmation-email endpoints (see orchardcore-rate-limits)./Security) are covered by orchardcore-passkeys.orchardcore-google, orchardcore-microsoft-auth, orchardcore-facebook, orchardcore-github-authentication, orchardcore-twitter, orchardcore-openid).{
"steps": [
{
"name": "Feature",
"enable": [
"OrchardCore.Users",
"OrchardCore.Users.Registration",
"OrchardCore.Users.ResetPassword",
"OrchardCore.Users.CustomUserSettings",
"OrchardCore.Roles"
],
"disable": []
}
]
}
Other Users features include OrchardCore.Users.ExternalAuthentication, Users Change Email, User Time Zone, User Localization, Users Authentication Ticket Store (server-side tickets in memory or distributed cache), Users Audit Trail, the Two-Factor Email, Authenticator App, and SMS methods (OrchardCore.Users.2FA.Email, OrchardCore.Users.2FA.AuthenticatorApp, OrchardCore.Users.2FA.Sms), and Passkeys (OrchardCore.Users.Passkeys). The two-factor methods and Passkeys enable User Security (OrchardCore.Users.Security, the Security page) by dependency; see orchardcore-passkeys.
using OrchardCore.Localization;
using OrchardCore.Security.Permissions;
namespace MyModule;
public static class MyFeaturePermissions
{
public static readonly Permission ManageMyFeature = new(
"ManageMyFeature",
LocalizationSource.Create("Manage my feature", typeof(MyFeaturePermissions)));
public static readonly Permission ViewMyFeature = new(
"ViewMyFeature",
LocalizationSource.Create("View my feature", typeof(MyFeaturePermissions)),
[ManageMyFeature]);
}
using OrchardCore;
using OrchardCore.Security.Permissions;
namespace MyModule;
internal sealed class PermissionProvider : IPermissionProvider
{
private readonly IEnumerable<Permission> _allPermissions =
[
MyFeaturePermissions.ManageMyFeature,
MyFeaturePermissions.ViewMyFeature,
];
public Task<IEnumerable<Permission>> GetPermissionsAsync()
=> Task.FromResult(_allPermissions);
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
new PermissionStereotype
{
Name = "Editor",
Permissions = [MyFeaturePermissions.ViewMyFeature],
},
];
}
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddPermissionProvider<PermissionProvider>();
}
}
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
public sealed class MyController : Controller
{
private readonly IAuthorizationService _authorizationService;
public MyController(IAuthorizationService authorizationService)
{
_authorizationService = authorizationService;
}
public async Task<IActionResult> Index()
{
if (!await _authorizationService.AuthorizeAsync(User, MyFeaturePermissions.ViewMyFeature))
{
return Forbid();
}
return View();
}
}
Role-specific user permissions are created from UsersPermissions, for example UsersPermissions.CreateAssignRoleToUsersPermission("Editor"), CreateEditUsersInRolePermission, CreateDeleteUsersInRolePermission, CreateListUsersInRolePermission, and CreatePermissionForManageUsersInRole. They are built from internal PermissionTemplates, so their descriptions ("Edit users in Editor role") are context-free and translated through Data Localization.
{% if User | has_permission: "ViewMyFeature" %}
<p>You have access to this feature.</p>
{% endif %}
The Administrator role does not receive permission claims during login. Use has_permission instead of checking a permission claim with has_claim.
{
"steps": [
{
"name": "Settings",
"LoginSettings": {
"UseSiteTheme": false,
"DisableLocalLogin": false,
"AllowRememberMe": true,
"UsePersistentAuthenticationCookie": false,
"AllowChangingUsername": false,
"AllowChangingEmail": false,
"AllowChangingPhoneNumber": true
}
}
]
}
Login settings are edited in Settings → Security → User Login, whose tabs are General, Two-Factor Authentication (TwoFactorLoginSettings), Security Page (UserSecuritySettings.UseSiteTheme, the theme of the Security page and the pages it links to) and External Login. UseSiteTheme of LoginSettings only themes the login page; TwoFactorLoginSettings.UseSiteTheme was replaced by UserSecuritySettings.UseSiteTheme.
UsePersistentAuthenticationCookie (Use persistent authentication cookies by default) controls whether local and external sign-ins survive browser restarts. With AllowRememberMe enabled it is the default value of the Remember me checkbox; with AllowRememberMe disabled it decides persistence for every sign-in.
{
"steps": [
{
"name": "Settings",
"RegistrationSettings": {
"UsersMustValidateEmail": true,
"UsersAreModerated": false,
"UseSiteTheme": false
},
"ResetPasswordSettings": {
"AllowResetPassword": true,
"UseSiteTheme": false
},
"ExternalLoginSettings": {
"UseExternalProviderIfOnlyOneDefined": false,
"UseScriptToSyncProperties": false,
"SyncPropertiesScript": ""
},
"ExternalRegistrationSettings": {
"DisableNewRegistrations": false,
"NoPassword": false,
"NoUsername": false,
"NoEmail": false,
"UseScriptToGenerateUsername": false,
"GenerateUsernameScript": ""
}
}
]
}
With OrchardCore.Deployment enabled, Login, Registration, Reset Password, Change Email, External login, and External registration settings each have a deployment step. The Change Email settings step exports ChangeEmailSettings; in 3.x it exported the wrong type, so plans exported with it did not carry the Change Email settings.
The Generate username script receives context with userName, loginProvider, and externalClaims; set context.userName. The Sync properties script receives context and fills rolesToAdd, rolesToRemove, claims, and properties. Orchard passes the per-login data through the scoped externalLoginContext() global, so write scripts against context and never build script text from user data.
When UsersMustValidateEmail is enabled, an unconfirmed user who signs in with a valid password lands on a page with Send confirmation email. The action is offered for about 10 minutes in the same browser (a short-lived cookie, not a sign-in), at most once per minute per user, and, with Rate Limits enabled, 2 requests per minute on the ResendEmailConfirmation route (email-confirmation policy), counted against the user who passed the password check, not the IP address.
A user also receives at most one password reset email per minute; further requests during that minute show the same confirmation page without sending an email, so the page does not reveal whether the account exists. Linking an external login to an existing account with its password counts a failed password check toward the account lockout, like the login page.
using OrchardCore.Users;
using OrchardCore.Users.Events;
public sealed class AuditLogoutFormEvent : LogoutFormEventBase
{
public override Task LoggingOutAsync(IUser user, CancellationToken cancellationToken = default)
{
// Runs before sign-out, while the principal is still available.
return Task.CompletedTask;
}
public override Task LoggedOutAsync(IUser user, CancellationToken cancellationToken = default)
{
// Runs after sign-out.
return Task.CompletedTask;
}
}
services.AddScoped<ILogoutFormEvent, AuditLogoutFormEvent>();
services.AddScoped<IRegistrationFormEvents, MyRegistrationEvents>();
ILoginFormEvent includes Task<IActionResult> ValidatingLoginAsync(IUser user).IRegistrationFormEvents includes Task RegisteringAsync(UserRegisteringContext context); derive from RegistrationFormEventsBase to override only what you need.OrchardCore.Workflows, the User Loggedout Event (UserLoggedOutEvent) complements User Loggedin Event.ExternalAuthenticationsController, not AccountController.using Microsoft.Extensions.Options;
using OrchardCore.Users.Models;
public sealed class RegistrationGate
{
private readonly IOptionsMonitor<RegistrationOptions> _registrationOptions;
public RegistrationGate(IOptionsMonitor<RegistrationOptions> registrationOptions)
{
_registrationOptions = registrationOptions;
}
public bool RequiresEmailConfirmation()
=> _registrationOptions.CurrentValue.UsersMustValidateEmail;
}
When OrchardCore.RateLimits is enabled, Users registers these route limits (per minute). The anonymous endpoints are counted per IP address and sized for users who share a network; account lockout and the one-email-per-minute rules protect each account.
| Endpoint (POST) | Limit | Counted against |
|---|---|---|
Login, link external login (password-authentication policy, shared with the OpenID password grant) | 100, sliding window | IP address |
| Registration, external registration | 20 | IP address |
| Forgot password, reset password | 20 | IP address |
| Resend confirmation email | 2 | User who passed the password check |
| Two-factor code / recovery code | 5 / 3 | User who passed the password check |
| Email or SMS authenticator send code | 2 | User who passed the password check |
Passkey login (Passkeys/Login, password-authentication policy) | 10, sliding window | IP address |
See orchardcore-rate-limits to tune them.
{
"OrchardCore": {
"Users": {
"LoginPath": "Login",
"LogoffPath": "Users/LogOff",
"ChangePasswordUrl": "ChangePassword",
"ChangePasswordConfirmationUrl": "ChangePasswordConfirmation",
"ExternalLoginsUrl": "ExternalLogins",
"SecurityPath": "Security",
"TwoFactorAuthenticationPath": "TwoFactor"
},
"Roles": {
"AdminRoleName": "Administrator"
}
}
}
{
"steps": [
{
"name": "Roles",
"Roles": [
{
"Name": "{{RoleName}}",
"Description": "{{RoleDescription}}",
"PermissionBehavior": "Replace",
"Permissions": [
"ViewMyFeature",
"AccessAdminPanel"
]
}
]
}
]
}
PermissionBehavior is Replace (default), Add (append missing permissions), or Remove (remove listed permissions).
AssignRoleToUsers is not implied by EditUsers. Grant AssignRoleToUsers explicitly, or a role-specific AssignRoleToUsers_{RoleName} permission.
ViewRoles (implied by ManageRoles) gives read-only access to the roles list and a role's permissions.Model.Editor built by drivers of CreateRoleViewModel, EditRoleViewModel and CloneRoleViewModel: a General card (CreateRoleGeneral_Edit, EditRoleGeneral_Edit, CloneRoleGeneral_Edit) and, on Edit and Clone, a Permissions card (RolePermissions_Edit). Overrides of the old page views must render Model.Editor; another module can add a card with a DisplayDriver<EditRoleViewModel> (see orchardcore-admin-edit-views).Administrator, Anonymous, Authenticated) cannot be deleted, and Administrator cannot be edited.await _userService.EnableAsync(user);
await _userService.DisableAsync(user);
{
"steps": [
{
"name": "command",
"Commands": [
"createUser /UserName:admin /Password:{{Password}} /Email:[email protected] /Roles:Administrator"
]
}
]
}
Use the CustomUserSettings stereotype for per-user fields. See orchardcore-custom-user-settings.
The Generate password button of the user editor uses the generatePassword default export of @orchardcore/bloom/helpers/passwordGenerator, which draws characters with crypto.getRandomValues() (a cryptographically secure RNG) instead of Math.random(). The password-generator script resource (window.passwordManager) is still registered but deprecated and will be removed in a future major version; custom editors should import the Bloom helper instead.
OrchardCore.Users.CommonPermissions was removed; use OrchardCore.Users.UsersPermissions (same member names).CommonPermissions.CreateAssignRoleToUsersPermission(role) returned the edit-users-in-role permission in 3.x. UsersPermissions.CreateAssignRoleToUsersPermission(role) returns the real assign-role permission; code that relied on the old result must call CreateEditUsersInRolePermission(role).StandardPermissions.SiteOwner is gone; use the Administrator role.Permission.Description is a LocalizationSource; use .Value or IStringLocalizerFactory.Localize(permission.Description).IOptions<RegistrationOptions> and IOptions<ExternalLoginOptions> become IOptionsMonitor<T> with CurrentValue.OrchardCore_Users to OrchardCore:Users and OrchardCore_Roles to OrchardCore:Roles (old names still work but are deprecated).password-generator script resource; use the Bloom generatePassword helper.TwoFactorAuthentication/Index.cshtml is now the UserSecurityTwoFactor shape, UserMenuItems-TwoFactor is UserMenuItems-Security, /TwoFactor redirects to /Security, and recipes set UserSecuritySettings.UseSiteTheme instead of TwoFactorLoginSettings.UseSiteTheme (see orchardcore-passkeys).UserRolesMeta moved from the Description zone to Meta (SummaryAdmin). UserDisplayName.SummaryAdminGrid renders users as badges in Grid lists. Re-check overrides of UserFields.cshtml and UserRolesMeta.cshtml.What SKILL.md sets; muted values are Claude Code's defaults
/orchardcore:orchardcore-users-rolesfrom 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.Other plugins' skills for the same job