Skip to content

Commit

Permalink
Merge pull request #21497 from abpframework/9.0-settings-fix
Browse files Browse the repository at this point in the history
Prevent rendering the settings component when there is no available setting
  • Loading branch information
gizemmutukurt authored Dec 2, 2024
2 parents f052a81 + 9dfdfab commit 39de966
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class TimeZonePageContributor : ISettingComponentContributor
public async Task ConfigureAsync(SettingComponentCreationContext context)
{
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<AbpSettingManagementResource>>();
if (context.ServiceProvider.GetRequiredService<IClock>().SupportsMultipleTimezone)
if (await CheckPermissionsAsync(context))
{
context.Groups.Add(
new SettingComponentGroup(
Expand All @@ -30,6 +30,7 @@ public async Task<bool> CheckPermissionsAsync(SettingComponentCreationContext co
{
var authorizationService = context.ServiceProvider.GetRequiredService<IAuthorizationService>();

return await authorizationService.IsGrantedAsync(SettingManagementPermissions.TimeZone);
return context.ServiceProvider.GetRequiredService<IClock>().SupportsMultipleTimezone
&& await authorizationService.IsGrantedAsync(SettingManagementPermissions.TimeZone);
}
}

0 comments on commit 39de966

Please sign in to comment.