Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [Feature] attribute to the permission providers that are associated with a feature in a module #15787

Closed
wants to merge 7 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace OrchardCore.ArchiveLater;

public class Startup : StartupBase
{

public override void ConfigureServices(IServiceCollection services)
{
services.Configure<TemplateOptions>(o =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Facebook;

[Feature(FacebookConstants.Features.Pixel)]
public class PixelPermissionProvider : IPermissionProvider
{
public static readonly Permission ManageFacebookPixelPermission = FacebookConstants.ManageFacebookPixelPermission;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Google;

[Feature(GoogleConstants.Features.GoogleAnalytics)]
public class GoogleAnalyticsPermissionsProvider : IPermissionProvider
{
public static readonly Permission ManageGoogleAnalytics = Permissions.ManageGoogleAnalytics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Google;

[Feature(GoogleConstants.Features.GoogleAuthentication)]
public class GoogleAuthenticationPermissionProvider : IPermissionProvider
{
public static readonly Permission ManageGoogleAuthentication = Permissions.ManageGoogleAuthentication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Google;

[Feature(GoogleConstants.Features.GoogleTagManager)]
public class GoogleTagManagerPermissionProvider : IPermissionProvider
{
public static readonly Permission ManageGoogleTagManager = Permissions.ManageGoogleTagManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Media.Azure;

[Feature("OrchardCore.Media.Azure.Storage")]
public class Permissions : IPermissionProvider
{
public static readonly Permission ViewAzureMediaOptions = new("ViewAzureMediaOptions", "View Azure Media Options");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Media;

[Feature("OrchardCore.Media.Cache")]
public class MediaCachePermissions : IPermissionProvider
{
public static readonly Permission ManageAssetCache = new("ManageAssetCache", "Manage Asset Cache Folder");
Expand Down
6 changes: 3 additions & 3 deletions src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public override void ConfigureServices(IServiceCollection services)
});

// Note: the following services are registered using TryAddEnumerable to prevent duplicate registrations.
services.TryAddEnumerable(new[]
{
services.TryAddEnumerable(
[
ServiceDescriptor.Scoped<IPermissionProvider, Permissions>(),
ServiceDescriptor.Scoped<INavigationProvider, AdminMenu>(),
});
]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace OrchardCore.PublishLater
{
public class Startup : StartupBase
{

public override void ConfigureServices(IServiceCollection services)
{
services.Configure<TemplateOptions>(o =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Queries.Sql;

[Feature("OrchardCore.Queries.Sql")]
public class Permissions : IPermissionProvider
{
public static readonly Permission ManageSqlQueries = new("ManageSqlQueries", "Manage SQL Queries");
Expand Down
2 changes: 0 additions & 2 deletions src/OrchardCore.Modules/OrchardCore.ReCaptcha/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace OrchardCore.ReCaptcha
{
[Feature("OrchardCore.ReCaptcha")]
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
Expand All @@ -28,7 +27,6 @@ public override void ConfigureServices(IServiceCollection services)
}
}

[Feature("OrchardCore.ReCaptcha")]
[RequireFeatures("OrchardCore.Deployment")]
public sealed class DeploymentStartup : StartupBase
{
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Modules/OrchardCore.Seo/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void ConfigureServices(IServiceCollection services)
services.AddScoped<IContentDisplayDriver, SeoContentDriver>();
services.AddScoped<IContentTypePartDefinitionDisplayDriver, SeoMetaPartSettingsDisplayDriver>();

// This must be last, and the module dependant on Contents so this runs after the part handlers.
// This must be last, and the module dependent on Contents so this runs after the part handlers.
services.AddScoped<IContentHandler, SeoMetaSettingsHandler>();
services.AddScoped<IContentItemIndexHandler, SeoMetaPartContentIndexHandler>();

Expand Down
2 changes: 2 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Shortcodes/Permissions.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Shortcodes;

[Feature("OrchardCore.Shortcodes.Templates")]
public class Permissions : IPermissionProvider
{
public static readonly Permission ManageShortcodeTemplates = new("ManageShortcodeTemplates", "Manage shortcode templates", isSecurityCritical: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
using System.Threading.Tasks;
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Models;
using OrchardCore.Modules;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Users;

[Feature("OrchardCore.Users.CustomUserSettings")]
public class CustomUserSettingsPermissions : IPermissionProvider
{
// This permission is never checked it is only used as a template.
Expand Down