1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 13:08:17 -05: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: image:
- Visual Studio 2017 - Visual Studio 2019
- Ubuntu1804 - Ubuntu1804
services: services:

View File

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

View File

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

View File

@ -6,6 +6,7 @@ using Bit.Core.Services;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Stripe; using Stripe;
@ -24,7 +25,7 @@ namespace Bit.Billing.Controllers
private const decimal PremiumPlanAppleIapPrice = 14.99M; private const decimal PremiumPlanAppleIapPrice = 14.99M;
private readonly BillingSettings _billingSettings; private readonly BillingSettings _billingSettings;
private readonly IHostingEnvironment _hostingEnvironment; private readonly IWebHostEnvironment _hostingEnvironment;
private readonly IOrganizationService _organizationService; private readonly IOrganizationService _organizationService;
private readonly IOrganizationRepository _organizationRepository; private readonly IOrganizationRepository _organizationRepository;
private readonly ITransactionRepository _transactionRepository; private readonly ITransactionRepository _transactionRepository;
@ -37,7 +38,7 @@ namespace Bit.Billing.Controllers
public StripeController( public StripeController(
GlobalSettings globalSettings, GlobalSettings globalSettings,
IOptions<BillingSettings> billingSettings, IOptions<BillingSettings> billingSettings,
IHostingEnvironment hostingEnvironment, IWebHostEnvironment hostingEnvironment,
IOrganizationService organizationService, IOrganizationService organizationService,
IOrganizationRepository organizationRepository, IOrganizationRepository organizationRepository,
ITransactionRepository transactionRepository, 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 // TODO
return Task.FromResult(0);
} }
public async Task<ICollection<DataModel.OrganizationAbility>> GetManyAbilitiesAsync() 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 // TODO
return Task.FromResult(0);
} }
public async Task UpdateRenewalReminderDateAsync(Guid id, DateTime renewalReminderDate) public async Task UpdateRenewalReminderDateAsync(Guid id, DateTime renewalReminderDate)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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