Skip to content

Commit

Permalink
Use constants for the common role names (#15751)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Apr 13, 2024
1 parent 2d39c38 commit e38011a
Show file tree
Hide file tree
Showing 77 changed files with 147 additions and 130 deletions.
10 changes: 5 additions & 5 deletions src/OrchardCore.Modules/OrchardCore.Admin/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ public IEnumerable<PermissionStereotype> 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,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ public IEnumerable<PermissionStereotype> 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,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _generalPermissions,
},
new PermissionStereotype
{
Name = "Editor",
Name = OrchardCoreConstants.Roles.Editor,
Permissions = _generalPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions =
[
ExecuteGraphQLMutations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ public IEnumerable<PermissionStereotype> 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,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
12 changes: 6 additions & 6 deletions src/OrchardCore.Modules/OrchardCore.Contents/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions =
[
PublishContent,
Expand All @@ -73,7 +73,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
},
new PermissionStereotype
{
Name = "Editor",
Name = OrchardCoreConstants.Roles.Editor,
Permissions =
[
PublishContent,
Expand All @@ -86,7 +86,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
},
new PermissionStereotype
{
Name = "Author",
Name = OrchardCoreConstants.Roles.Author,
Permissions =
[
PublishOwnContent,
Expand All @@ -98,7 +98,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
},
new PermissionStereotype
{
Name = "Contributor",
Name = OrchardCoreConstants.Roles.Contributor,
Permissions =
[
EditOwnContent,
Expand All @@ -108,12 +108,12 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
},
new PermissionStereotype
{
Name = "Authenticated",
Name = OrchardCoreConstants.Roles.Authenticated,
Permissions = _readerPermissions,
},
new PermissionStereotype
{
Name = "Anonymous",
Name = OrchardCoreConstants.Roles.Anonymous,
Permissions = _readerPermissions,
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Modules/OrchardCore.Cors/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
10 changes: 5 additions & 5 deletions src/OrchardCore.Modules/OrchardCore.Demo/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Authenticated",
Name = OrchardCoreConstants.Roles.Authenticated,
Permissions =
[
DemoAPIAccess,
],
},
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,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Modules/OrchardCore.GitHub/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Modules/OrchardCore.Https/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Modules/OrchardCore.Layers/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = "Administrator",
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
Expand Down
Loading

0 comments on commit e38011a

Please sign in to comment.