From 8b87b4e17096790d21e883a98bc2d2cbe65e38d4 Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 29 Nov 2024 16:33:25 +0300 Subject: [PATCH 1/2] Prevent crashing at SettingManagement.razor --- .../Pages/SettingManagement/SettingManagement.razor.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs index 202598ff8da..9eb0ca977a1 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs @@ -42,7 +42,10 @@ protected async override Task OnInitializedAsync() SettingComponentCreationContext.Normalize(); SettingItemRenders.Clear(); - SelectedGroup = GetNormalizedString(SettingComponentCreationContext.Groups.First().Id); + if (SettingComponentCreationContext.Groups.Any()) + { + SelectedGroup = GetNormalizedString(SettingComponentCreationContext.Groups.First().Id); + } } protected override async Task OnAfterRenderAsync(bool firstRender) From 9dfdfab54b5052f130644c7d0b37591ba52bba19 Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 29 Nov 2024 16:33:39 +0300 Subject: [PATCH 2/2] Better check for TimeZonePageContributor --- .../Settings/TimeZonePageContributor.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Settings/TimeZonePageContributor.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Settings/TimeZonePageContributor.cs index 6effd644941..7aa4164bdfd 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Settings/TimeZonePageContributor.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Settings/TimeZonePageContributor.cs @@ -14,7 +14,7 @@ public class TimeZonePageContributor : ISettingComponentContributor public async Task ConfigureAsync(SettingComponentCreationContext context) { var l = context.ServiceProvider.GetRequiredService>(); - if (context.ServiceProvider.GetRequiredService().SupportsMultipleTimezone) + if (await CheckPermissionsAsync(context)) { context.Groups.Add( new SettingComponentGroup( @@ -30,6 +30,7 @@ public async Task CheckPermissionsAsync(SettingComponentCreationContext co { var authorizationService = context.ServiceProvider.GetRequiredService(); - return await authorizationService.IsGrantedAsync(SettingManagementPermissions.TimeZone); + return context.ServiceProvider.GetRequiredService().SupportsMultipleTimezone + && await authorizationService.IsGrantedAsync(SettingManagementPermissions.TimeZone); } }