mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
[PS-40] Upgrade to .NET 6 (#2056)
* Bump to .NET 6 * Update Docker images * Update docs * Update workflow for linter * Add all common versions to props file * Update tools manifest * Update csproj files * Update packages.lock.json files * Switch to setup-dotnet * Remove msbuild * Fix deps breaking changes * Manually install msbuild * Use msbuild for build * Fix verbosity switch * Remove unused exceptions * Address linter feedback * Make Obsolete warnings suggestions for now. * Force Evaluate * Format on tests * Run formatting again. * Use windows 2022 * force evaluate * Fix restore * Fix linter * Skip test * Update Directory.Build.props Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Address PR feedback * Add IntegationTest for Rate limiter * Fix test * Reenable test * Reorder test * Skip test again * Add tracking link * Update .github/workflows/build.yml Co-authored-by: Micaiah Martin <77340197+mimartin12@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Micaiah Martin <77340197+mimartin12@users.noreply.github.com>
This commit is contained in:
@ -9,6 +9,7 @@ using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Settings;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
@ -21,6 +22,8 @@ namespace Bit.Core.Services
|
||||
private static readonly TimeSpan blobLinkLiveTime = TimeSpan.FromMinutes(1);
|
||||
private readonly BlobServiceClient _blobServiceClient;
|
||||
private readonly Dictionary<string, BlobContainerClient> _attachmentContainers = new Dictionary<string, BlobContainerClient>();
|
||||
private readonly ILogger<AzureAttachmentStorageService> _logger;
|
||||
|
||||
private string BlobName(Guid cipherId, CipherAttachment.MetaData attachmentData, Guid? organizationId = null, bool temp = false) =>
|
||||
string.Concat(
|
||||
temp ? "temp/" : "",
|
||||
@ -53,9 +56,11 @@ namespace Bit.Core.Services
|
||||
}
|
||||
|
||||
public AzureAttachmentStorageService(
|
||||
GlobalSettings globalSettings)
|
||||
GlobalSettings globalSettings,
|
||||
ILogger<AzureAttachmentStorageService> logger)
|
||||
{
|
||||
_blobServiceClient = new BlobServiceClient(globalSettings.Attachment.ConnectionString);
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<string> GetAttachmentDownloadUrlAsync(Cipher cipher, CipherAttachment.MetaData attachmentData)
|
||||
@ -226,6 +231,7 @@ namespace Bit.Core.Services
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Unhandled error in ValidateFileAsync");
|
||||
return (false, null);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ using Azure.Storage.Sas;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Settings;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
@ -16,6 +17,7 @@ namespace Bit.Core.Services
|
||||
public const string FilesContainerName = "sendfiles";
|
||||
private static readonly TimeSpan _downloadLinkLiveTime = TimeSpan.FromMinutes(1);
|
||||
private readonly BlobServiceClient _blobServiceClient;
|
||||
private readonly ILogger<AzureSendFileStorageService> _logger;
|
||||
private BlobContainerClient _sendFilesContainerClient;
|
||||
|
||||
public FileUploadType FileUploadType => FileUploadType.Azure;
|
||||
@ -24,9 +26,11 @@ namespace Bit.Core.Services
|
||||
public static string BlobName(Send send, string fileId) => $"{send.Id}/{fileId}";
|
||||
|
||||
public AzureSendFileStorageService(
|
||||
GlobalSettings globalSettings)
|
||||
GlobalSettings globalSettings,
|
||||
ILogger<AzureSendFileStorageService> logger)
|
||||
{
|
||||
_blobServiceClient = new BlobServiceClient(globalSettings.Send.ConnectionString);
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task UploadNewFileAsync(Stream stream, Send send, string fileId)
|
||||
@ -125,6 +129,7 @@ namespace Bit.Core.Services
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Unhandled error in ValidateFileAsync");
|
||||
return (false, null);
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ namespace Bit.Core.Services
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IMailDeliveryService _mailDeliveryService;
|
||||
private readonly IMailEnqueuingService _mailEnqueuingService;
|
||||
private readonly Dictionary<string, Func<object, string>> _templateCache =
|
||||
new Dictionary<string, Func<object, string>>();
|
||||
private readonly Dictionary<string, HandlebarsTemplate<object, object>> _templateCache =
|
||||
new Dictionary<string, HandlebarsTemplate<object, object>>();
|
||||
|
||||
private bool _registeredHelpersAndPartials = false;
|
||||
|
||||
|
@ -851,7 +851,7 @@ namespace Bit.Core.Services
|
||||
if (userCount > license.Seats.Value)
|
||||
{
|
||||
throw new BadRequestException($"Your organization currently has {userCount} seats filled. " +
|
||||
$"Your new license only has ({ license.Seats.Value}) seats. Remove some users.");
|
||||
$"Your new license only has ({license.Seats.Value}) seats. Remove some users.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,8 +161,9 @@ namespace Bit.Core.Services
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error creating customer, walking back operation.");
|
||||
if (customer != null)
|
||||
{
|
||||
await _stripeAdapter.CustomerDeleteAsync(customer.Id);
|
||||
|
Reference in New Issue
Block a user