diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Admin/Permissions.cs index fac741d8475..334dfb7222d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/Permissions.cs @@ -20,27 +20,27 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Moderator", + Name = OrchardCoreConstants.Roles.Moderator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Author", + Name = OrchardCoreConstants.Roles.Author, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Contributor", + Name = OrchardCoreConstants.Roles.Contributor, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/PermissionsAdminSettings.cs b/src/OrchardCore.Modules/OrchardCore.Admin/PermissionsAdminSettings.cs index 85189fb4d2a..f13c92d74c8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/PermissionsAdminSettings.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/PermissionsAdminSettings.cs @@ -17,7 +17,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Permissions.cs index e59d0afd210..a1d62fd800e 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Permissions.cs @@ -27,27 +27,27 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Moderator", + Name = OrchardCoreConstants.Roles.Moderator, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Author", + Name = OrchardCoreConstants.Roles.Author, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Contributor", + Name = OrchardCoreConstants.Roles.Contributor, Permissions = _generalPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Views/DashboardWidget-ContentsMetadata.DetailAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Views/DashboardWidget-ContentsMetadata.DetailAdmin.cshtml index 8a889c3dcf2..6865e52a1cf 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Views/DashboardWidget-ContentsMetadata.DetailAdmin.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Views/DashboardWidget-ContentsMetadata.DetailAdmin.cshtml @@ -13,7 +13,7 @@ { ContentItem contentItem = Model.ContentItem; var modifiedUtc = contentItem.ModifiedUtc?.ToString("yyyy-MM-ddTHH:mm:sszzz", CultureInfo.InvariantCulture); - var hasPublished = await ContentManager.HasPublishedVersionAsync(contentItem); + var hasPublished = await ContentManager.HasPublishedVersionAsync(contentItem); var hasDraft = contentItem.HasDraft(); if (contentItem.ModifiedUtc.HasValue) diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs index d7e84da1b52..09b8b321090 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs @@ -46,12 +46,12 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _generalPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Permissions.cs index d890058f209..0679fc6c51c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Permissions.cs @@ -22,7 +22,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = [ ExecuteGraphQLMutations, diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Permissions.cs index 2a9398f4dc7..a9d7968c807 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Permissions.cs @@ -22,7 +22,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Permissions.cs index 924380c8769..9fb0347bacc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/Permissions.cs index 6f8a7a532aa..26052f177f0 100644 --- a/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Permissions.cs index 4e3d42e6c6b..9e2b39a6163 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Permissions.cs @@ -29,22 +29,22 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Author", + Name = OrchardCoreConstants.Roles.Author, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Contributor", + Name = OrchardCoreConstants.Roles.Contributor, Permissions = _generalPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Permissions.cs index 2fdb506986a..83a1dd5cbd1 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Permissions.cs @@ -22,7 +22,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Permissions.cs index 304edb53fc8..7edb0f806f2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Permissions.cs @@ -58,7 +58,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = [ PublishContent, @@ -73,7 +73,7 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = [ PublishContent, @@ -86,7 +86,7 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Author", + Name = OrchardCoreConstants.Roles.Author, Permissions = [ PublishOwnContent, @@ -98,7 +98,7 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Contributor", + Name = OrchardCoreConstants.Roles.Contributor, Permissions = [ EditOwnContent, @@ -108,12 +108,12 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Authenticated", + Name = OrchardCoreConstants.Roles.Authenticated, Permissions = _readerPermissions, }, new PermissionStereotype { - Name = "Anonymous", + Name = OrchardCoreConstants.Roles.Anonymous, Permissions = _readerPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Cors/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Cors/Permissions.cs index b95ed88605b..4ced51ff922 100644 --- a/src/OrchardCore.Modules/OrchardCore.Cors/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Cors/Permissions.cs @@ -21,7 +21,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Demo/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Demo/Permissions.cs index ca32b869b2a..a802ab0ab11 100644 --- a/src/OrchardCore.Modules/OrchardCore.Demo/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Demo/Permissions.cs @@ -28,7 +28,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Authenticated", + Name = OrchardCoreConstants.Roles.Authenticated, Permissions = [ DemoAPIAccess, @@ -36,22 +36,22 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Moderator", + Name = OrchardCoreConstants.Roles.Moderator, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Contributor", + Name = OrchardCoreConstants.Roles.Contributor, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Author", + Name = OrchardCoreConstants.Roles.Author, Permissions = _generalPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Permissions.cs index 21e25dc13bc..ef10aee1ab3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Permissions.cs @@ -24,7 +24,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Permissions.cs index 700ce606332..9575653bf9a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Permissions.cs @@ -24,7 +24,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Facebook/Permissions.cs index 7a147113e51..a8840fd77cb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/PixelPermissionProvider.cs b/src/OrchardCore.Modules/OrchardCore.Facebook/PixelPermissionProvider.cs index 438061b8a8b..6807439f81f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/PixelPermissionProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/PixelPermissionProvider.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Features/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Features/Permissions.cs index 64ffdff25e5..c4756dbc446 100644 --- a/src/OrchardCore.Modules/OrchardCore.Features/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Features/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.GitHub/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.GitHub/Permissions.cs index 6ea951ce41c..70b7058029a 100644 --- a/src/OrchardCore.Modules/OrchardCore.GitHub/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.GitHub/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAnalyticsPermissionsProvider.cs b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAnalyticsPermissionsProvider.cs index 42943baa0f6..81ff3e6cd88 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAnalyticsPermissionsProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAnalyticsPermissionsProvider.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationPermissionProvider.cs b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationPermissionProvider.cs index 115f8274ed9..73c5197ed23 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationPermissionProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationPermissionProvider.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Google/GoogleTagManagerPermissionProvider.cs b/src/OrchardCore.Modules/OrchardCore.Google/GoogleTagManagerPermissionProvider.cs index e4d55201421..61ce08af13b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/GoogleTagManagerPermissionProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/GoogleTagManagerPermissionProvider.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Https/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Https/Permissions.cs index a7ba0125afa..864894e337f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Https/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Https/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Indexing/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Indexing/Permissions.cs index e30c801d08b..1e5f4ee8405 100644 --- a/src/OrchardCore.Modules/OrchardCore.Indexing/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Indexing/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Permissions.cs index b6bc3d3ca75..3fe3638577a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Localization/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Localization/Permissions.cs index 40d80c5a8f6..5e2252b16c7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Localization/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Localization/Permissions.cs @@ -26,7 +26,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Permissions.cs index 443b56a25ee..238fcc5c333 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Media.Azure/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Media.Azure/Permissions.cs index a92526b37be..db9841caed5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.Azure/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.Azure/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Media/MediaCachePermissions.cs b/src/OrchardCore.Modules/OrchardCore.Media/MediaCachePermissions.cs index 2a01e042761..bcffcc63c65 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/MediaCachePermissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/MediaCachePermissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Media/Permissions.cs index b41e2877360..8d91d652637 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Permissions.cs @@ -37,7 +37,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = [ ManageMediaFolder, @@ -47,7 +47,7 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = [ ManageMedia, @@ -56,12 +56,12 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Author", + Name = OrchardCoreConstants.Roles.Author, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Contributor", + Name = OrchardCoreConstants.Roles.Contributor, Permissions = _generalPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Permissions.cs index 3ec0bc2fa3d..165d7b9f666 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Permissions.cs index 8bee6617d03..68db22c3010 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Permissions.cs @@ -21,7 +21,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.MiniProfiler/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.MiniProfiler/Permissions.cs index 66e56cd09eb..981cedb68bc 100644 --- a/src/OrchardCore.Modules/OrchardCore.MiniProfiler/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.MiniProfiler/Permissions.cs @@ -22,7 +22,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Notifications/NotificationPermissionsProvider.cs b/src/OrchardCore.Modules/OrchardCore.Notifications/NotificationPermissionsProvider.cs index 484b84dbc91..23537016cae 100644 --- a/src/OrchardCore.Modules/OrchardCore.Notifications/NotificationPermissionsProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Notifications/NotificationPermissionsProvider.cs @@ -20,32 +20,32 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Moderator", + Name = OrchardCoreConstants.Roles.Moderator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Author", + Name = OrchardCoreConstants.Roles.Author, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Contributor", + Name = OrchardCoreConstants.Roles.Contributor, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Authenticated", + Name = OrchardCoreConstants.Roles.Authenticated, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Permissions.cs index 3ed8b1c9686..e9448b93c31 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Permissions.cs @@ -37,7 +37,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Permissions.cs index 8953929261e..76ab8de4b6a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Permissions.cs @@ -20,12 +20,12 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Permissions.cs index e8766208f81..a2e1ed6dfde 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Permissions.cs @@ -43,12 +43,12 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _generalPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Permissions.cs index ab11836c034..ea81d34c2d8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Permissions.cs @@ -20,12 +20,12 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.ReCaptcha/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.ReCaptcha/Permissions.cs index 65b987b4f52..f4ab6c25048 100644 --- a/src/OrchardCore.Modules/OrchardCore.ReCaptcha/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.ReCaptcha/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.ReverseProxy/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.ReverseProxy/Permissions.cs index 76bd4546420..e2089a7d001 100644 --- a/src/OrchardCore.Modules/OrchardCore.ReverseProxy/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.ReverseProxy/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs index d779b29abf4..41b1bbb1a87 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs @@ -283,8 +283,8 @@ private async Task> GetEffectivePermissions(Role role, IEnum { // Create a fake user to check the actual permissions. If the role is anonymous // IsAuthenticated needs to be false. - var fakeIdentity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Role, role.RoleName) }, - !string.Equals(role.RoleName, "Anonymous", StringComparison.OrdinalIgnoreCase) ? "FakeAuthenticationType" : null); + var fakeIdentity = new ClaimsIdentity([new Claim(ClaimTypes.Role, role.RoleName)], + !string.Equals(role.RoleName, OrchardCoreConstants.Roles.Anonymous, StringComparison.OrdinalIgnoreCase) ? "FakeAuthenticationType" : null); // Add role claims fakeIdentity.AddClaims(role.RoleClaims.Select(c => c.ToClaim())); diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Permissions.cs index 95bae82fed7..190e30d1fcf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Permissions.cs @@ -45,7 +45,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = [ ManageRoles, diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Services/RolesPermissionsHandler.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Services/RolesPermissionsHandler.cs index 127714ab505..0fe85c79526 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Services/RolesPermissionsHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Services/RolesPermissionsHandler.cs @@ -35,14 +35,14 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext } var claims = new HashSet(); - foreach (var claim in _anonymousClaims ??= await GetRoleClaimsAsync("Anonymous")) + foreach (var claim in _anonymousClaims ??= await GetRoleClaimsAsync(OrchardCoreConstants.Roles.Anonymous)) { claims.Add(claim); } if (context.User.Identity.IsAuthenticated) { - foreach (var claim in _authenticatedClaims ??= await GetRoleClaimsAsync("Authenticated")) + foreach (var claim in _authenticatedClaims ??= await GetRoleClaimsAsync(OrchardCoreConstants.Roles.Authenticated)) { claims.Add(claim); } diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Views/Items/GetUsersByRoleTask.Fields.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Roles/Views/Items/GetUsersByRoleTask.Fields.Edit.cshtml index 781bcb31e72..1d6de351123 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Views/Items/GetUsersByRoleTask.Fields.Edit.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Views/Items/GetUsersByRoleTask.Fields.Edit.cshtml @@ -1,3 +1,4 @@ +@using OrchardCore @using OrchardCore.Roles.Workflows.ViewModels @model GetUsersByRoleTaskViewModel @@ -11,7 +12,7 @@
- @await Component.InvokeAsync("SelectRoles", new { selectedRoles = Model.Roles, htmlName = Html.NameFor(m => m.Roles), except = new[] { "Anonymous", "Authenticated" } }) + @await Component.InvokeAsync("SelectRoles", new { selectedRoles = Model.Roles, htmlName = Html.NameFor(m => m.Roles), except = new[] { OrchardCoreConstants.Roles.Anonymous, OrchardCoreConstants.Roles.Authenticated } }) @T["Choose the roles used to identify users during list generation."]
diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Views/Items/UnassignUserRoleTask.Fields.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Roles/Views/Items/UnassignUserRoleTask.Fields.Edit.cshtml index 3af6eddbc2d..ce13d94ba9a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Views/Items/UnassignUserRoleTask.Fields.Edit.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Views/Items/UnassignUserRoleTask.Fields.Edit.cshtml @@ -1,3 +1,4 @@ +@using OrchardCore @using OrchardCore.Roles.Workflows.ViewModels @model UnassignUserRoleTaskViewModel @@ -11,7 +12,7 @@
- @await Component.InvokeAsync("SelectRoles", new { selectedRoles = Model.Roles, htmlName = Html.NameFor(m => m.Roles), except = new[] { "Anonymous", "Authenticated" } }) + @await Component.InvokeAsync("SelectRoles", new { selectedRoles = Model.Roles, htmlName = Html.NameFor(m => m.Roles), except = new[] { OrchardCoreConstants.Roles.Anonymous, OrchardCoreConstants.Roles.Authenticated } }) @T["The Roles to remove."]
diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Permissions.cs index e7f52fa8094..468c9ef238b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Permissions.cs @@ -39,7 +39,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = [ ManageElasticIndexes, @@ -47,7 +47,7 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = [ QueryElasticApi, diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Permissions.cs index 1ff55c627d3..ebe695e640a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Permissions.cs @@ -39,7 +39,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = [ ManageLuceneIndexes, @@ -47,7 +47,7 @@ public IEnumerable GetDefaultStereotypes() => }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = [ QueryLuceneApi, diff --git a/src/OrchardCore.Modules/OrchardCore.Search/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Search/Permissions.cs index d4227db57a3..84ddb5185b6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search/Permissions.cs @@ -23,7 +23,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Security/SecurityPermissions.cs b/src/OrchardCore.Modules/OrchardCore.Security/SecurityPermissions.cs index 7d6a5be17c7..ea260c5433e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Security/SecurityPermissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Security/SecurityPermissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/SeoPermissionProvider.cs b/src/OrchardCore.Modules/OrchardCore.Seo/SeoPermissionProvider.cs index 189f5cef01d..02a273d3f35 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/SeoPermissionProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/SeoPermissionProvider.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Permissions.cs index 13067b4c1db..863aab2426f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Permissions.cs @@ -23,7 +23,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Permissions.cs index 1337f888c8a..8235a7b116a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Permissions.cs @@ -20,12 +20,12 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Permissions.cs index 2b44f442f14..c4c2fbcdd9e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Sms/SmsPermissionProvider.cs b/src/OrchardCore.Modules/OrchardCore.Sms/SmsPermissionProvider.cs index 56133661a61..2947d694e8a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sms/SmsPermissionProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sms/SmsPermissionProvider.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Permissions.cs index 7cd8497a04f..d598334d26d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/AdminTemplatesPermissions.cs b/src/OrchardCore.Modules/OrchardCore.Templates/AdminTemplatesPermissions.cs index 4eb873a2e05..f51e8119452 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/AdminTemplatesPermissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/AdminTemplatesPermissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Templates/Permissions.cs index 753281617a6..46e85977be2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/Permissions.cs @@ -20,12 +20,12 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Permissions.cs index 97330139bd4..c288e4a23b0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Permissions.cs @@ -22,7 +22,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Permissions.cs index fddc1b32fad..df8bfa89f09 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/Permissions.cs index 2235a81af65..26663aafa39 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/Permissions.cs @@ -23,7 +23,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs index f696343d4d4..ada0d461b7a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs @@ -177,7 +177,7 @@ public async Task Index([ModelBinder(BinderType = typeof(UserFilte options.UserRoleFilters = [ new SelectListItem() { Text = S["Any role"], Value = string.Empty, Selected = options.SelectedRole == string.Empty }, - new SelectListItem() { Text = S["Authenticated (no roles)"], Value = "Authenticated", Selected = string.Equals(options.SelectedRole, "Authenticated", StringComparison.OrdinalIgnoreCase) }, + new SelectListItem() { Text = S["Authenticated (no roles)"], Value = OrchardCoreConstants.Roles.Authenticated, Selected = string.Equals(options.SelectedRole, OrchardCoreConstants.Roles.Authenticated, StringComparison.OrdinalIgnoreCase) }, // TODO Candidate for dynamic localization. .. roleNames.Select(roleName => new SelectListItem diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs index 7180290b2a4..eb8fd2a1978 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs @@ -21,7 +21,6 @@ namespace OrchardCore.Users.Drivers { public class UserDisplayDriver : DisplayDriver { - private const string AdministratorRole = "Administrator"; private readonly UserManager _userManager; private readonly IHttpContextAccessor _httpContextAccessor; private readonly INotifier _notifier; @@ -113,7 +112,7 @@ public override async Task UpdateAsync(User user, UpdateEditorCo if (!isEditingDisabled && !model.IsEnabled && user.IsEnabled) { - var enabledUsersOfAdminRole = (await _userManager.GetUsersInRoleAsync(AdministratorRole)) + var enabledUsersOfAdminRole = (await _userManager.GetUsersInRoleAsync(OrchardCoreConstants.Roles.Administrator)) .Cast() .Where(user => user.IsEnabled) .ToList(); diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs index 982c5036701..87e70d36100 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs @@ -19,8 +19,6 @@ namespace OrchardCore.Users.Drivers { public class UserRoleDisplayDriver : DisplayDriver { - private const string AdministratorRole = "Administrator"; - private readonly UserManager _userManager; private readonly IRoleService _roleService; private readonly IUserRoleStore _userRoleStore; @@ -140,9 +138,9 @@ public override async Task UpdateAsync(User user, UpdateEditorCo foreach (var role in rolesToRemove) { - if (string.Equals(role, AdministratorRole, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(role, OrchardCoreConstants.Roles.Administrator, StringComparison.OrdinalIgnoreCase)) { - var enabledUsersOfAdminRole = (await _userManager.GetUsersInRoleAsync(AdministratorRole)) + var enabledUsersOfAdminRole = (await _userManager.GetUsersInRoleAsync(OrchardCoreConstants.Roles.Administrator)) .Cast() .Where(user => user.IsEnabled) .ToList(); @@ -150,7 +148,7 @@ public override async Task UpdateAsync(User user, UpdateEditorCo // Make sure we always have at least one enabled administrator account. if (enabledUsersOfAdminRole.Count == 1 && user.UserId == enabledUsersOfAdminRole.First().UserId) { - await _notifier.WarningAsync(H[$"Cannot remove {AdministratorRole} role from the only enabled administrator."]); + await _notifier.WarningAsync(H[$"Cannot remove {OrchardCoreConstants.Roles.Administrator} role from the only enabled administrator."]); continue; } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Users/Permissions.cs index 8f17b9304ad..82a53451247 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Permissions.cs @@ -36,27 +36,27 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Moderator", + Name = OrchardCoreConstants.Roles.Moderator, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Contributor", + Name = OrchardCoreConstants.Roles.Contributor, Permissions = _generalPermissions, }, new PermissionStereotype { - Name = "Author", + Name = OrchardCoreConstants.Roles.Author, Permissions = _generalPermissions, } ]; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs b/src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs index aa390b27af9..43b1cf724e8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs @@ -28,7 +28,7 @@ public Task SetupAsync(SetupContext context) EmailConfirmed = true }; - user.RoleNames.Add("Administrator"); + user.RoleNames.Add(OrchardCoreConstants.Roles.Administrator); return _userService.CreateUserAsync(user, context.Properties[SetupConstants.AdminPassword]?.ToString(), (key, message) => { diff --git a/src/OrchardCore.Modules/OrchardCore.Users/UserRolePermissions.cs b/src/OrchardCore.Modules/OrchardCore.Users/UserRolePermissions.cs index 4340c5bdd46..72e9a3bdf8a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/UserRolePermissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/UserRolePermissions.cs @@ -44,7 +44,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = [ AssignRoleToUsers, diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/ValidateUserTask.Fields.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/ValidateUserTask.Fields.Edit.cshtml index 7dc52c41e17..f4d8ff521d9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/ValidateUserTask.Fields.Edit.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/ValidateUserTask.Fields.Edit.cshtml @@ -1,3 +1,4 @@ +@using OrchardCore @model OrchardCore.Users.Workflows.ViewModels.ValidateUserTaskViewModel
@@ -8,7 +9,7 @@
- @await Component.InvokeAsync("SelectRoles", new { selectedRoles = Model.Roles, htmlName = Html.NameFor(m => m.Roles), except = new[] { "Anonymous", "Authenticated" } }) + @await Component.InvokeAsync("SelectRoles", new { selectedRoles = Model.Roles, htmlName = Html.NameFor(m => m.Roles), except = new[] { OrchardCoreConstants.Roles.Anonymous, OrchardCoreConstants.Roles.Authenticated } }) @T["The 'InRole' outcome will be triggered if the user has at least one of the selected roles."]
diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/ValidateUserTask.cs b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/ValidateUserTask.cs index c3e66bda050..2566b5eda0d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/ValidateUserTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/ValidateUserTask.cs @@ -73,10 +73,10 @@ public override ActivityExecutionResult Execute(WorkflowExecutionContext workflo } } - return Outcomes("Authenticated"); + return Outcomes(OrchardCoreConstants.Roles.Authenticated); } - return Outcomes("Anonymous"); + return Outcomes(OrchardCoreConstants.Roles.Anonymous); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Permissions.cs index 1c3686eb336..c22f0d9f618 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Permissions.cs @@ -22,12 +22,12 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, new PermissionStereotype { - Name = "Editor", + Name = OrchardCoreConstants.Roles.Editor, Permissions = _allPermissions, } ]; diff --git a/src/OrchardCore/OrchardCore.Abstractions/OrchardCoreConstants.cs b/src/OrchardCore/OrchardCore.Abstractions/OrchardCoreConstants.cs index 384c6b3b4be..3540798ae63 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/OrchardCoreConstants.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/OrchardCoreConstants.cs @@ -11,4 +11,21 @@ public class Configuration { public const string ApplicationSettingsFileName = "appsettings.json"; } + + public class Roles + { + public const string Administrator = "Administrator"; + + public const string Editor = "Editor"; + + public const string Moderator = "Moderator"; + + public const string Author = "Author"; + + public const string Contributor = "Contributor"; + + public const string Authenticated = "Authenticated"; + + public const string Anonymous = "Anonymous"; + } } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Permissions.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Permissions.cs index efedc48431a..67b3d77ec12 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Permissions.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore/OrchardCore.Email.Core/Permissions.cs b/src/OrchardCore/OrchardCore.Email.Core/Permissions.cs index 01e2044a9c5..a263590e269 100644 --- a/src/OrchardCore/OrchardCore.Email.Core/Permissions.cs +++ b/src/OrchardCore/OrchardCore.Email.Core/Permissions.cs @@ -20,7 +20,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = _allPermissions, }, ]; diff --git a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Security/Services/RoleHelper.cs b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Security/Services/RoleHelper.cs index ca17a1564d8..33a8cca2b05 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Security/Services/RoleHelper.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Security/Services/RoleHelper.cs @@ -7,8 +7,8 @@ public class RoleHelper { public static readonly HashSet SystemRoleNames = new(StringComparer.OrdinalIgnoreCase) { - "Anonymous", - "Authenticated", + OrchardCoreConstants.Roles.Anonymous, + OrchardCoreConstants.Roles.Authenticated, }; } } diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Permissions.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Permissions.cs index 38e9d5db8ad..fdf5e1d3755 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Permissions.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Permissions.cs @@ -30,7 +30,7 @@ public IEnumerable GetDefaultStereotypes() => [ new PermissionStereotype { - Name = "Administrator", + Name = OrchardCoreConstants.Roles.Administrator, Permissions = [ AzureAISearchIndexPermissionHelper.ManageAzureAISearchIndexes, diff --git a/src/OrchardCore/OrchardCore.Users.Core/Indexes/UserByRoleNameIndex.cs b/src/OrchardCore/OrchardCore.Users.Core/Indexes/UserByRoleNameIndex.cs index bb3fe817d39..34bdb371dea 100644 --- a/src/OrchardCore/OrchardCore.Users.Core/Indexes/UserByRoleNameIndex.cs +++ b/src/OrchardCore/OrchardCore.Users.Core/Indexes/UserByRoleNameIndex.cs @@ -31,7 +31,7 @@ public override void Describe(DescribeContext context) return new UserByRoleNameIndex[] { new() { - RoleName = NormalizeKey("Authenticated"), + RoleName = NormalizeKey(OrchardCoreConstants.Roles.Authenticated), Count = 1 } }; diff --git a/test/OrchardCore.Tests/Modules/OrchardCore.Roles/RolesPermissionsHandlerTests.cs b/test/OrchardCore.Tests/Modules/OrchardCore.Roles/RolesPermissionsHandlerTests.cs index 17c340ebbec..6c8cafde0ba 100644 --- a/test/OrchardCore.Tests/Modules/OrchardCore.Roles/RolesPermissionsHandlerTests.cs +++ b/test/OrchardCore.Tests/Modules/OrchardCore.Roles/RolesPermissionsHandlerTests.cs @@ -20,7 +20,7 @@ public async Task GrantsRolesPermissions(string required, bool authenticated, bo var permissionHandler = CreatePermissionHandler( new Role { - RoleName = "Anonymous", + RoleName = OrchardCoreConstants.Roles.Anonymous, RoleClaims = [ new() { ClaimType = Permission.ClaimType, ClaimValue = "AllowAnonymous" } @@ -28,7 +28,7 @@ public async Task GrantsRolesPermissions(string required, bool authenticated, bo }, new Role { - RoleName = "Authenticated", + RoleName = OrchardCoreConstants.Roles.Authenticated, RoleClaims = [ new() { ClaimType = Permission.ClaimType, ClaimValue = "AllowAuthenticated" } @@ -73,7 +73,7 @@ public async Task GrantsInheritedPermissions() var permissionHandler = CreatePermissionHandler( new Role { - RoleName = "Anonymous", + RoleName = OrchardCoreConstants.Roles.Anonymous, RoleClaims = [ new() { ClaimType = Permission.ClaimType, ClaimValue = "Implicit2" } @@ -99,7 +99,7 @@ public async Task IsCaseIsensitive(string required, bool authenticated) var permissionHandler = CreatePermissionHandler( new Role { - RoleName = "Anonymous", + RoleName = OrchardCoreConstants.Roles.Anonymous, RoleClaims = [ new() { ClaimType = Permission.ClaimType, ClaimValue = "aLlOwAnOnYmOuS" } @@ -107,7 +107,7 @@ public async Task IsCaseIsensitive(string required, bool authenticated) }, new Role { - RoleName = "Authenticated", + RoleName = OrchardCoreConstants.Roles.Authenticated, RoleClaims = [ new() { ClaimType = Permission.ClaimType, ClaimValue = "aLlOwAuThEnTiCaTeD" }