maliming
3 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
13 additions and
5 deletions
-
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Settings/TimeZonePageContributor.cs
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using Volo.Abp.Features; |
|
|
|
@ -13,7 +14,7 @@ public class TimeZonePageContributor : ISettingComponentContributor |
|
|
|
public async Task ConfigureAsync(SettingComponentCreationContext context) |
|
|
|
{ |
|
|
|
await CheckFeatureAsync(context); |
|
|
|
|
|
|
|
|
|
|
|
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<AbpSettingManagementResource>>(); |
|
|
|
if (context.ServiceProvider.GetRequiredService<IClock>().SupportsMultipleTimezone) |
|
|
|
{ |
|
|
|
@ -27,15 +28,22 @@ public class TimeZonePageContributor : ISettingComponentContributor |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Task<bool> CheckPermissionsAsync(SettingComponentCreationContext context) |
|
|
|
public async Task<bool> CheckPermissionsAsync(SettingComponentCreationContext context) |
|
|
|
{ |
|
|
|
return Task.FromResult(true); |
|
|
|
if (!await CheckFeatureAsync(context)) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
var authorizationService = context.ServiceProvider.GetRequiredService<IAuthorizationService>(); |
|
|
|
|
|
|
|
return await authorizationService.IsGrantedAsync(SettingManagementPermissions.TimeZone); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task<bool> CheckFeatureAsync(SettingComponentCreationContext context) |
|
|
|
{ |
|
|
|
var featureCheck = context.ServiceProvider.GetRequiredService<IFeatureChecker>(); |
|
|
|
|
|
|
|
return await featureCheck.IsEnabledAsync(SettingManagementFeatures.EnableTimeZone); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|