BEST
DEALS
OF THE
YEAR!
SAVE UP TO $3,000
24 NOV
1 DEC
00 Days
00 Hrs
00 Min
00 Sec
Open Closed

Permission check issue adding a custom SettingComponentContributor #7732


User avatar
0
balessi75 created

ABP Commercial 7.4.2 / Blazor Server / EF / Non tiered / Separate Host and Tenant DBs / Lepton Theme

Hi,

Our custom SettingComponentContributor is defined as below. What we are finding is that the ConfigureAsync method executes, but the CheckPermissionsAsync method never executes. The group shows in the UI without the permission check. Is there something we are misunderstanding when it comes to only showing a settings group if the current user has a certain permission?

Thanks in advance.

namespace FM.nVision.Blazor.Settings
{
    public class NotificationSettingComponentContributor : ISettingComponentContributor
    {
        public Task ConfigureAsync(SettingComponentCreationContext context)
        {
            context.Groups.Add(
                new SettingComponentGroup(
                    "FM.nVision.Settings",
                    "Email Notifications",
                    typeof(NotificationSettingGroupComponent), order: 8888
                )
            );

            return Task.CompletedTask;
        }

        public async Task<bool> CheckPermissionsAsync(SettingComponentCreationContext context)
        {
            // check the permissions here
            var authService = context.ServiceProvider.GetRequiredService<IAuthorizationService>();

            if (await authService.IsGrantedAsync(nVisionPermissions.Notifications.Settings))
            {

                return true;

            }
            return false;

        }
    }

}

ConfigureServices

        Configure<SettingManagementComponentOptions>(options =>
        {

            options.Contributors.Add(new NotificationSettingComponentContributor());
            options.Contributors.Add(new AboutSettingComponentContributor());
        });

2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    you need to call CheckPermissionsAsync method yourself.

  • User Avatar
    0
    balessi75 created

    That makes sense. Thanks @liangshiwei !!

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on November 20, 2025, 09:12
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.