1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-08 19:47:44 +01:00

fix warnings

This commit is contained in:
Kyle Spearrin 2020-01-10 08:47:58 -05:00
parent 29580684a3
commit 7fd6e4359d
12 changed files with 28 additions and 20 deletions

View File

@ -1,5 +1,5 @@
image:
- Visual Studio 2017
- Visual Studio 2019
- Ubuntu1804
services:

View File

@ -9,6 +9,7 @@ using System.Linq;
using Microsoft.AspNetCore.Hosting;
using Bit.Api.Utilities;
using Bit.Core.Utilities;
using Microsoft.Extensions.Hosting;
namespace Bit.Api.Controllers
{
@ -19,14 +20,14 @@ namespace Bit.Api.Controllers
{
private readonly IPushRegistrationService _pushRegistrationService;
private readonly IPushNotificationService _pushNotificationService;
private readonly IHostingEnvironment _environment;
private readonly IWebHostEnvironment _environment;
private readonly CurrentContext _currentContext;
private readonly GlobalSettings _globalSettings;
public PushController(
IPushRegistrationService pushRegistrationService,
IPushNotificationService pushNotificationService,
IHostingEnvironment environment,
IWebHostEnvironment environment,
CurrentContext currentContext,
GlobalSettings globalSettings)
{

View File

@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
using Stripe;
using Microsoft.Extensions.Hosting;
namespace Bit.Api.Utilities
{
@ -113,7 +114,7 @@ namespace Bit.Api.Utilities
else
{
var errorModel = internalErrorModel ?? new InternalApi.ErrorResponseModel(errorMessage);
var env = context.HttpContext.RequestServices.GetRequiredService<IHostingEnvironment>();
var env = context.HttpContext.RequestServices.GetRequiredService<IWebHostEnvironment>();
if(env.IsDevelopment())
{
errorModel.ExceptionMessage = exception.Message;

View File

@ -6,6 +6,7 @@ using Bit.Core.Services;
using Bit.Core.Utilities;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Stripe;
@ -24,7 +25,7 @@ namespace Bit.Billing.Controllers
private const decimal PremiumPlanAppleIapPrice = 14.99M;
private readonly BillingSettings _billingSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly IOrganizationService _organizationService;
private readonly IOrganizationRepository _organizationRepository;
private readonly ITransactionRepository _transactionRepository;
@ -37,7 +38,7 @@ namespace Bit.Billing.Controllers
public StripeController(
GlobalSettings globalSettings,
IOptions<BillingSettings> billingSettings,
IHostingEnvironment hostingEnvironment,
IWebHostEnvironment hostingEnvironment,
IOrganizationService organizationService,
IOrganizationRepository organizationRepository,
ITransactionRepository transactionRepository,

View File

@ -49,9 +49,10 @@ namespace Bit.Core.Repositories.EntityFramework
}
}
public async Task UpdateStorageAsync(Guid id)
public Task UpdateStorageAsync(Guid id)
{
// TODO
return Task.FromResult(0);
}
public async Task<ICollection<DataModel.OrganizationAbility>> GetManyAbilitiesAsync()

View File

@ -83,9 +83,10 @@ namespace Bit.Core.Repositories.EntityFramework
}
}
public async Task UpdateStorageAsync(Guid id)
public Task UpdateStorageAsync(Guid id)
{
// TODO
return Task.FromResult(0);
}
public async Task UpdateRenewalReminderDateAsync(Guid id, DateTime renewalReminderDate)

View File

@ -14,7 +14,7 @@ namespace Bit.Core.Services
public class AmazonSesMailDeliveryService : IMailDeliveryService, IDisposable
{
private readonly GlobalSettings _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly ILogger<AmazonSesMailDeliveryService> _logger;
private readonly AmazonSimpleEmailServiceClient _client;
private readonly string _source;
@ -23,7 +23,7 @@ namespace Bit.Core.Services
public AmazonSesMailDeliveryService(
GlobalSettings globalSettings,
IHostingEnvironment hostingEnvironment,
IWebHostEnvironment hostingEnvironment,
ILogger<AmazonSesMailDeliveryService> logger)
{
if(string.IsNullOrWhiteSpace(globalSettings.Amazon?.AccessKeyId))

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Bit.Billing.Models;
using Bit.Core.Repositories;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -17,13 +18,13 @@ namespace Bit.Core.Services
private readonly HttpClient _httpClient = new HttpClient();
private readonly GlobalSettings _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly IMetaDataRepository _metaDataRespository;
private readonly ILogger<AppleIapService> _logger;
public AppleIapService(
GlobalSettings globalSettings,
IHostingEnvironment hostingEnvironment,
IWebHostEnvironment hostingEnvironment,
IMetaDataRepository metaDataRespository,
ILogger<AppleIapService> logger)
{

View File

@ -13,6 +13,7 @@ using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
namespace Bit.Core.Services
{
@ -31,7 +32,7 @@ namespace Bit.Core.Services
IUserRepository userRepository,
IOrganizationRepository organizationRepository,
IOrganizationUserRepository organizationUserRepository,
IHostingEnvironment environment,
IWebHostEnvironment environment,
ILogger<LicensingService> logger,
GlobalSettings globalSettings)
{

View File

@ -3,13 +3,14 @@ using Microsoft.AspNetCore.Hosting;
using System;
using Bit.Core.Models.Business;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
namespace Bit.Core.Services
{
public class NoopLicensingService : ILicensingService
{
public NoopLicensingService(
IHostingEnvironment environment,
IWebHostEnvironment environment,
GlobalSettings globalSettings)
{
if(!environment.IsDevelopment() && globalSettings.SelfHosted)

View File

@ -1,4 +1,4 @@
using System;
using System;
using Bit.Core.Services;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
@ -12,13 +12,13 @@ namespace Bit.Core.Test.Services
private readonly AmazonSesMailDeliveryService _sut;
private readonly GlobalSettings _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly ILogger<AmazonSesMailDeliveryService> _logger;
public AmazonSesMailDeliveryServiceTests()
{
_globalSettings = new GlobalSettings();
_hostingEnvironment = Substitute.For<IHostingEnvironment>();
_hostingEnvironment = Substitute.For<IWebHostEnvironment>();
_logger = Substitute.For<ILogger<AmazonSesMailDeliveryService>>();
_sut = new AmazonSesMailDeliveryService(
_globalSettings,

View File

@ -1,4 +1,4 @@
using System;
using System;
using Bit.Core.Repositories;
using Bit.Core.Services;
using Microsoft.AspNetCore.Hosting;
@ -16,7 +16,7 @@ namespace Bit.Core.Test.Services
private readonly IUserRepository _userRepository;
private readonly IOrganizationRepository _organizationRepository;
private readonly IOrganizationUserRepository _organizationUserRepository;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly ILogger<LicensingService> _logger;
public LicensingServiceTests()
@ -24,7 +24,7 @@ namespace Bit.Core.Test.Services
_userRepository = Substitute.For<IUserRepository>();
_organizationRepository = Substitute.For<IOrganizationRepository>();
_organizationUserRepository = Substitute.For<IOrganizationUserRepository>();
_hostingEnvironment = Substitute.For<IHostingEnvironment>();
_hostingEnvironment = Substitute.For<IWebHostEnvironment>();
_logger = Substitute.For<ILogger<LicensingService>>();
_globalSettings = new GlobalSettings();