mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
[PM-1969] Spellcheck other (#2878)
* Fix typo in error message: 'Unkown' -> 'Unknown' * Fix typos in error message * Fix typo in example text: 'licence' -> 'license' * Fix typo in validation: 'Ooganization' -> 'Organization' * Fix typo in text string: 'compatibilty' -> 'compatibility' * Fix typo: 'ProviderDisllowedOrganizationTypes' -> 'ProviderDisallowedOrganizationTypes' * Fix typo: 'NSubstitueVersion' -> 'NSubstituteVersion' * Fix typo: 'CreateIntialInvite' -> 'CreateInitialInvite' * Fix typo: '_queuryScheme' -> '_queryScheme' * Fix typo: 'GetApplicationCacheServiceBusSubcriptionName' -> 'GetApplicationCacheServiceBusSubscriptionName' * Fix typo: 'metaDataRespository' -> 'metaDataRepository' * Fix typo: 'cipherAttachements' -> 'cipherAttachments' * Fix typo: 'savedEmergencyAccesss' -> 'savedEmergencyAccesses' * Fix typo: 'owerOrgUser' -> 'ownerOrgUser' * Fix typo: 'Organiation' -> 'Organization' * Fix typo: 'extistingUser' -> 'existingUser' * Fix typo: 'availibleAccess' -> 'availableAccess' * Fix typo: 'HasEnouphStorage' -> 'HasEnoughStorage' * Fix typo: 'extistingOrg' -> 'existingOrg' * Fix typo: 'subcriber' -> 'subscriber' * Fix typo: 'availibleCollections' -> 'availableCollections' * Fix typo: 'Succes' -> 'Success' * Fix typo: 'CreateAsync_UpdateWithCollecitons_Works' -> 'CreateAsync_UpdateWithCollections_Works' * Fix typo: 'BadInsallationId' -> 'BadInstallationId' * Fix typo: 'OrgNotFamiles' -> 'OrgNotFamilies' * Revert "Fix typo: 'Organiation' -> 'Organization'" This reverts commit8aadad1c25
. * Revert "Fix typos in error message" This reverts commit81d201fc09
. --------- Co-authored-by: Daniel James Smith <djsmith@web.de>
This commit is contained in:
@ -35,7 +35,7 @@
|
|||||||
<!--
|
<!--
|
||||||
NuGet: https://www.nuget.org/packages/NSubstitute/
|
NuGet: https://www.nuget.org/packages/NSubstitute/
|
||||||
-->
|
-->
|
||||||
<NSubstitueVersion>4.3.0</NSubstitueVersion>
|
<NSubstituteVersion>4.3.0</NSubstituteVersion>
|
||||||
<!--
|
<!--
|
||||||
NuGet: https://www.nuget.org/packages/AutoFixture.Xunit2/
|
NuGet: https://www.nuget.org/packages/AutoFixture.Xunit2/
|
||||||
-->
|
-->
|
||||||
|
@ -17,7 +17,7 @@ namespace Bit.Commercial.Core.Services;
|
|||||||
|
|
||||||
public class ProviderService : IProviderService
|
public class ProviderService : IProviderService
|
||||||
{
|
{
|
||||||
public static PlanType[] ProviderDisllowedOrganizationTypes = new[] { PlanType.Free, PlanType.FamiliesAnnually, PlanType.FamiliesAnnually2019 };
|
public static PlanType[] ProviderDisallowedOrganizationTypes = new[] { PlanType.Free, PlanType.FamiliesAnnually, PlanType.FamiliesAnnually2019 };
|
||||||
|
|
||||||
private readonly IDataProtector _dataProtector;
|
private readonly IDataProtector _dataProtector;
|
||||||
private readonly IMailService _mailService;
|
private readonly IMailService _mailService;
|
||||||
@ -493,7 +493,7 @@ public class ProviderService : IProviderService
|
|||||||
|
|
||||||
private void ThrowOnInvalidPlanType(PlanType requestedType)
|
private void ThrowOnInvalidPlanType(PlanType requestedType)
|
||||||
{
|
{
|
||||||
if (ProviderDisllowedOrganizationTypes.Contains(requestedType))
|
if (ProviderDisallowedOrganizationTypes.Contains(requestedType))
|
||||||
{
|
{
|
||||||
throw new BadRequestException($"Providers cannot manage organizations with the requested plan type ({requestedType}). Only Teams and Enterprise accounts are allowed.");
|
throw new BadRequestException($"Providers cannot manage organizations with the requested plan type ({requestedType}). Only Teams and Enterprise accounts are allowed.");
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.5" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -26,6 +26,6 @@
|
|||||||
"id": "<your Installation Id>",
|
"id": "<your Installation Id>",
|
||||||
"key": "<your Installation Key>"
|
"key": "<your Installation Key>"
|
||||||
},
|
},
|
||||||
"licenseDirectory": "<full path to licence directory>"
|
"licenseDirectory": "<full path to license directory>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,14 +410,14 @@ public class TwoFactorController : Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Leaving this for backwards compatibilty on clients")]
|
[Obsolete("Leaving this for backwards compatibility on clients")]
|
||||||
[HttpGet("get-device-verification-settings")]
|
[HttpGet("get-device-verification-settings")]
|
||||||
public Task<DeviceVerificationResponseModel> GetDeviceVerificationSettings()
|
public Task<DeviceVerificationResponseModel> GetDeviceVerificationSettings()
|
||||||
{
|
{
|
||||||
return Task.FromResult(new DeviceVerificationResponseModel(false, false));
|
return Task.FromResult(new DeviceVerificationResponseModel(false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Leaving this for backwards compatibilty on clients")]
|
[Obsolete("Leaving this for backwards compatibility on clients")]
|
||||||
[HttpPut("device-verification-settings")]
|
[HttpPut("device-verification-settings")]
|
||||||
public Task<DeviceVerificationResponseModel> PutDeviceVerificationSettings(
|
public Task<DeviceVerificationResponseModel> PutDeviceVerificationSettings(
|
||||||
[FromBody] DeviceVerificationRequestModel model)
|
[FromBody] DeviceVerificationRequestModel model)
|
||||||
|
@ -17,9 +17,9 @@ public class UpdateTwoFactorAuthenticatorRequestModel : SecretVerificationReques
|
|||||||
[StringLength(50)]
|
[StringLength(50)]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
public User ToUser(User extistingUser)
|
public User ToUser(User existingUser)
|
||||||
{
|
{
|
||||||
var providers = extistingUser.GetTwoFactorProviders();
|
var providers = existingUser.GetTwoFactorProviders();
|
||||||
if (providers == null)
|
if (providers == null)
|
||||||
{
|
{
|
||||||
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
||||||
@ -34,8 +34,8 @@ public class UpdateTwoFactorAuthenticatorRequestModel : SecretVerificationReques
|
|||||||
MetaData = new Dictionary<string, object> { ["Key"] = Key },
|
MetaData = new Dictionary<string, object> { ["Key"] = Key },
|
||||||
Enabled = true
|
Enabled = true
|
||||||
});
|
});
|
||||||
extistingUser.SetTwoFactorProviders(providers);
|
existingUser.SetTwoFactorProviders(providers);
|
||||||
return extistingUser;
|
return existingUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,9 +51,9 @@ public class UpdateTwoFactorDuoRequestModel : SecretVerificationRequestModel, IV
|
|||||||
[StringLength(50)]
|
[StringLength(50)]
|
||||||
public string Host { get; set; }
|
public string Host { get; set; }
|
||||||
|
|
||||||
public User ToUser(User extistingUser)
|
public User ToUser(User existingUser)
|
||||||
{
|
{
|
||||||
var providers = extistingUser.GetTwoFactorProviders();
|
var providers = existingUser.GetTwoFactorProviders();
|
||||||
if (providers == null)
|
if (providers == null)
|
||||||
{
|
{
|
||||||
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
||||||
@ -73,13 +73,13 @@ public class UpdateTwoFactorDuoRequestModel : SecretVerificationRequestModel, IV
|
|||||||
},
|
},
|
||||||
Enabled = true
|
Enabled = true
|
||||||
});
|
});
|
||||||
extistingUser.SetTwoFactorProviders(providers);
|
existingUser.SetTwoFactorProviders(providers);
|
||||||
return extistingUser;
|
return existingUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Organization ToOrganization(Organization extistingOrg)
|
public Organization ToOrganization(Organization existingOrg)
|
||||||
{
|
{
|
||||||
var providers = extistingOrg.GetTwoFactorProviders();
|
var providers = existingOrg.GetTwoFactorProviders();
|
||||||
if (providers == null)
|
if (providers == null)
|
||||||
{
|
{
|
||||||
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
||||||
@ -99,8 +99,8 @@ public class UpdateTwoFactorDuoRequestModel : SecretVerificationRequestModel, IV
|
|||||||
},
|
},
|
||||||
Enabled = true
|
Enabled = true
|
||||||
});
|
});
|
||||||
extistingOrg.SetTwoFactorProviders(providers);
|
existingOrg.SetTwoFactorProviders(providers);
|
||||||
return extistingOrg;
|
return existingOrg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||||
@ -122,9 +122,9 @@ public class UpdateTwoFactorYubicoOtpRequestModel : SecretVerificationRequestMod
|
|||||||
[Required]
|
[Required]
|
||||||
public bool? Nfc { get; set; }
|
public bool? Nfc { get; set; }
|
||||||
|
|
||||||
public User ToUser(User extistingUser)
|
public User ToUser(User existingUser)
|
||||||
{
|
{
|
||||||
var providers = extistingUser.GetTwoFactorProviders();
|
var providers = existingUser.GetTwoFactorProviders();
|
||||||
if (providers == null)
|
if (providers == null)
|
||||||
{
|
{
|
||||||
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
||||||
@ -147,8 +147,8 @@ public class UpdateTwoFactorYubicoOtpRequestModel : SecretVerificationRequestMod
|
|||||||
},
|
},
|
||||||
Enabled = true
|
Enabled = true
|
||||||
});
|
});
|
||||||
extistingUser.SetTwoFactorProviders(providers);
|
existingUser.SetTwoFactorProviders(providers);
|
||||||
return extistingUser;
|
return existingUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string FormatKey(string keyValue)
|
private string FormatKey(string keyValue)
|
||||||
@ -205,9 +205,9 @@ public class TwoFactorEmailRequestModel : SecretVerificationRequestModel
|
|||||||
public string AuthRequestId { get; set; }
|
public string AuthRequestId { get; set; }
|
||||||
// An auth session token used for obtaining email and as an authN factor for the sending of emailed 2FA OTPs.
|
// An auth session token used for obtaining email and as an authN factor for the sending of emailed 2FA OTPs.
|
||||||
public string SsoEmail2FaSessionToken { get; set; }
|
public string SsoEmail2FaSessionToken { get; set; }
|
||||||
public User ToUser(User extistingUser)
|
public User ToUser(User existingUser)
|
||||||
{
|
{
|
||||||
var providers = extistingUser.GetTwoFactorProviders();
|
var providers = existingUser.GetTwoFactorProviders();
|
||||||
if (providers == null)
|
if (providers == null)
|
||||||
{
|
{
|
||||||
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
providers = new Dictionary<TwoFactorProviderType, TwoFactorProvider>();
|
||||||
@ -222,8 +222,8 @@ public class TwoFactorEmailRequestModel : SecretVerificationRequestModel
|
|||||||
MetaData = new Dictionary<string, object> { ["Email"] = Email.ToLowerInvariant() },
|
MetaData = new Dictionary<string, object> { ["Email"] = Email.ToLowerInvariant() },
|
||||||
Enabled = true
|
Enabled = true
|
||||||
});
|
});
|
||||||
extistingUser.SetTwoFactorProviders(providers);
|
existingUser.SetTwoFactorProviders(providers);
|
||||||
return extistingUser;
|
return existingUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||||
|
@ -101,7 +101,7 @@ public class OrganizationConnectionsController : Controller
|
|||||||
case OrganizationConnectionType.Scim:
|
case OrganizationConnectionType.Scim:
|
||||||
return await CreateOrUpdateOrganizationConnectionAsync<ScimConfig>(organizationConnectionId, model);
|
return await CreateOrUpdateOrganizationConnectionAsync<ScimConfig>(organizationConnectionId, model);
|
||||||
default:
|
default:
|
||||||
throw new BadRequestException($"Unkown Organization connection Type: {model.Type}");
|
throw new BadRequestException($"Unknown Organization connection Type: {model.Type}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ public class OrganizationConnectionsController : Controller
|
|||||||
case OrganizationConnectionType.Scim:
|
case OrganizationConnectionType.Scim:
|
||||||
return new OrganizationConnectionResponseModel(connection, typeof(ScimConfig));
|
return new OrganizationConnectionResponseModel(connection, typeof(ScimConfig));
|
||||||
default:
|
default:
|
||||||
throw new BadRequestException($"Unkown Organization connection Type: {type}");
|
throw new BadRequestException($"Unknown Organization connection Type: {type}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class ProviderUsersController : Controller
|
|||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
var invite = ProviderUserInviteFactory.CreateIntialInvite(model.Emails, model.Type.Value,
|
var invite = ProviderUserInviteFactory.CreateInitialInvite(model.Emails, model.Type.Value,
|
||||||
_userService.GetProperUserId(User).Value, providerId);
|
_userService.GetProperUserId(User).Value, providerId);
|
||||||
await _providerService.InviteUserAsync(invite);
|
await _providerService.InviteUserAsync(invite);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class BitPayInvoiceRequestModel : IValidatableObject
|
|||||||
{
|
{
|
||||||
if (!UserId.HasValue && !OrganizationId.HasValue)
|
if (!UserId.HasValue && !OrganizationId.HasValue)
|
||||||
{
|
{
|
||||||
yield return new ValidationResult("User or Ooganization is required.");
|
yield return new ValidationResult("User or Organization is required.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace Bit.Api.Models.Request;
|
|||||||
|
|
||||||
public class DeviceVerificationRequestModel
|
public class DeviceVerificationRequestModel
|
||||||
{
|
{
|
||||||
[Obsolete("Leaving this for backwards compatibilty on clients")]
|
[Obsolete("Leaving this for backwards compatibility on clients")]
|
||||||
[Required]
|
[Required]
|
||||||
public bool UnknownDeviceVerificationEnabled { get; set; }
|
public bool UnknownDeviceVerificationEnabled { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bit.Api.Models.Response;
|
namespace Bit.Api.Models.Response;
|
||||||
|
|
||||||
[Obsolete("Leaving this for backwards compatibilty on clients")]
|
[Obsolete("Leaving this for backwards compatibility on clients")]
|
||||||
public class DeviceVerificationResponseModel : ResponseModel
|
public class DeviceVerificationResponseModel : ResponseModel
|
||||||
{
|
{
|
||||||
public DeviceVerificationResponseModel(bool isDeviceVerificationSectionEnabled, bool unknownDeviceVerificationEnabled)
|
public DeviceVerificationResponseModel(bool isDeviceVerificationSectionEnabled, bool unknownDeviceVerificationEnabled)
|
||||||
|
@ -5,7 +5,7 @@ namespace Bit.Core.Auth.IdentityServer;
|
|||||||
public static class TokenRetrieval
|
public static class TokenRetrieval
|
||||||
{
|
{
|
||||||
private static string _headerScheme = "Bearer ";
|
private static string _headerScheme = "Bearer ";
|
||||||
private static string _queuryScheme = "access_token";
|
private static string _queryScheme = "access_token";
|
||||||
private static string _authHeader = "Authorization";
|
private static string _authHeader = "Authorization";
|
||||||
|
|
||||||
public static Func<HttpRequest, string> FromAuthorizationHeaderOrQueryString()
|
public static Func<HttpRequest, string> FromAuthorizationHeaderOrQueryString()
|
||||||
@ -15,7 +15,7 @@ public static class TokenRetrieval
|
|||||||
var authorization = request.Headers[_authHeader].FirstOrDefault();
|
var authorization = request.Headers[_authHeader].FirstOrDefault();
|
||||||
if (string.IsNullOrWhiteSpace(authorization))
|
if (string.IsNullOrWhiteSpace(authorization))
|
||||||
{
|
{
|
||||||
return request.Query[_queuryScheme].FirstOrDefault();
|
return request.Query[_queryScheme].FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authorization.StartsWith(_headerScheme, StringComparison.OrdinalIgnoreCase))
|
if (authorization.StartsWith(_headerScheme, StringComparison.OrdinalIgnoreCase))
|
||||||
|
@ -418,11 +418,11 @@ public class EmergencyAccessService : IEmergencyAccessService
|
|||||||
return string.IsNullOrWhiteSpace(user.Name) ? user.Email : user.Name;
|
return string.IsNullOrWhiteSpace(user.Name) ? user.Email : user.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsValidRequest(EmergencyAccess availibleAccess, User requestingUser, EmergencyAccessType requestedAccessType)
|
private bool IsValidRequest(EmergencyAccess availableAccess, User requestingUser, EmergencyAccessType requestedAccessType)
|
||||||
{
|
{
|
||||||
return availibleAccess != null &&
|
return availableAccess != null &&
|
||||||
availibleAccess.GranteeId == requestingUser.Id &&
|
availableAccess.GranteeId == requestingUser.Id &&
|
||||||
availibleAccess.Status == EmergencyAccessStatusType.RecoveryApproved &&
|
availableAccess.Status == EmergencyAccessStatusType.RecoveryApproved &&
|
||||||
availibleAccess.Type == requestedAccessType;
|
availableAccess.Type == requestedAccessType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class ApplicationCacheHostedService : IHostedService, IDisposable
|
|||||||
GlobalSettings globalSettings)
|
GlobalSettings globalSettings)
|
||||||
{
|
{
|
||||||
_topicName = globalSettings.ServiceBus.ApplicationCacheTopicName;
|
_topicName = globalSettings.ServiceBus.ApplicationCacheTopicName;
|
||||||
_subName = CoreHelpers.GetApplicationCacheServiceBusSubcriptionName(globalSettings);
|
_subName = CoreHelpers.GetApplicationCacheServiceBusSubscriptionName(globalSettings);
|
||||||
_applicationCacheService = applicationCacheService as InMemoryServiceBusApplicationCacheService;
|
_applicationCacheService = applicationCacheService as InMemoryServiceBusApplicationCacheService;
|
||||||
_organizationRepository = organizationRepository;
|
_organizationRepository = organizationRepository;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
@ -12,7 +12,7 @@ public class ProviderUserInvite<T>
|
|||||||
|
|
||||||
public static class ProviderUserInviteFactory
|
public static class ProviderUserInviteFactory
|
||||||
{
|
{
|
||||||
public static ProviderUserInvite<string> CreateIntialInvite(IEnumerable<string> inviteeEmails, ProviderUserType type, Guid invitingUserId, Guid providerId)
|
public static ProviderUserInvite<string> CreateInitialInvite(IEnumerable<string> inviteeEmails, ProviderUserType type, Guid invitingUserId, Guid providerId)
|
||||||
{
|
{
|
||||||
return new ProviderUserInvite<string>
|
return new ProviderUserInvite<string>
|
||||||
{
|
{
|
||||||
|
@ -15,18 +15,18 @@ public class AppleIapService : IAppleIapService
|
|||||||
|
|
||||||
private readonly GlobalSettings _globalSettings;
|
private readonly GlobalSettings _globalSettings;
|
||||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||||
private readonly IMetaDataRepository _metaDataRespository;
|
private readonly IMetaDataRepository _metaDataRepository;
|
||||||
private readonly ILogger<AppleIapService> _logger;
|
private readonly ILogger<AppleIapService> _logger;
|
||||||
|
|
||||||
public AppleIapService(
|
public AppleIapService(
|
||||||
GlobalSettings globalSettings,
|
GlobalSettings globalSettings,
|
||||||
IWebHostEnvironment hostingEnvironment,
|
IWebHostEnvironment hostingEnvironment,
|
||||||
IMetaDataRepository metaDataRespository,
|
IMetaDataRepository metaDataRepository,
|
||||||
ILogger<AppleIapService> logger)
|
ILogger<AppleIapService> logger)
|
||||||
{
|
{
|
||||||
_globalSettings = globalSettings;
|
_globalSettings = globalSettings;
|
||||||
_hostingEnvironment = hostingEnvironment;
|
_hostingEnvironment = hostingEnvironment;
|
||||||
_metaDataRespository = metaDataRespository;
|
_metaDataRepository = metaDataRepository;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class AppleIapService : IAppleIapService
|
|||||||
{
|
{
|
||||||
throw new Exception("OriginalTransactionId is null");
|
throw new Exception("OriginalTransactionId is null");
|
||||||
}
|
}
|
||||||
await _metaDataRespository.UpsertAsync("AppleReceipt", originalTransactionId,
|
await _metaDataRepository.UpsertAsync("AppleReceipt", originalTransactionId,
|
||||||
new Dictionary<string, string>
|
new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
["Data"] = receiptStatus.GetReceiptData(),
|
["Data"] = receiptStatus.GetReceiptData(),
|
||||||
@ -71,7 +71,7 @@ public class AppleIapService : IAppleIapService
|
|||||||
|
|
||||||
public async Task<Tuple<string, Guid?>> GetReceiptAsync(string originalTransactionId)
|
public async Task<Tuple<string, Guid?>> GetReceiptAsync(string originalTransactionId)
|
||||||
{
|
{
|
||||||
var receipt = await _metaDataRespository.GetAsync("AppleReceipt", originalTransactionId);
|
var receipt = await _metaDataRepository.GetAsync("AppleReceipt", originalTransactionId);
|
||||||
if (receipt == null)
|
if (receipt == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -18,7 +18,7 @@ public class InMemoryServiceBusApplicationCacheService : InMemoryApplicationCach
|
|||||||
GlobalSettings globalSettings)
|
GlobalSettings globalSettings)
|
||||||
: base(organizationRepository, providerRepository)
|
: base(organizationRepository, providerRepository)
|
||||||
{
|
{
|
||||||
_subName = CoreHelpers.GetApplicationCacheServiceBusSubcriptionName(globalSettings);
|
_subName = CoreHelpers.GetApplicationCacheServiceBusSubscriptionName(globalSettings);
|
||||||
_topicClient = new TopicClient(globalSettings.ServiceBus.ConnectionString,
|
_topicClient = new TopicClient(globalSettings.ServiceBus.ConnectionString,
|
||||||
globalSettings.ServiceBus.ApplicationCacheTopicName);
|
globalSettings.ServiceBus.ApplicationCacheTopicName);
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ public class StripePaymentService : IPaymentService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Stripe.Subscription> ChargeForNewSubscriptionAsync(ISubscriber subcriber, Stripe.Customer customer,
|
private async Task<Stripe.Subscription> ChargeForNewSubscriptionAsync(ISubscriber subscriber, Stripe.Customer customer,
|
||||||
bool createdStripeCustomer, bool stripePaymentMethod, PaymentMethodType paymentMethodType,
|
bool createdStripeCustomer, bool stripePaymentMethod, PaymentMethodType paymentMethodType,
|
||||||
Stripe.SubscriptionCreateOptions subCreateOptions, Braintree.Customer braintreeCustomer)
|
Stripe.SubscriptionCreateOptions subCreateOptions, Braintree.Customer braintreeCustomer)
|
||||||
{
|
{
|
||||||
@ -556,7 +556,7 @@ public class StripePaymentService : IPaymentService
|
|||||||
customer.Metadata.ContainsKey("btCustomerId") ? customer.Metadata["btCustomerId"] : null;
|
customer.Metadata.ContainsKey("btCustomerId") ? customer.Metadata["btCustomerId"] : null;
|
||||||
if (!string.IsNullOrWhiteSpace(appleReceiptOrigTransactionId))
|
if (!string.IsNullOrWhiteSpace(appleReceiptOrigTransactionId))
|
||||||
{
|
{
|
||||||
if (!subcriber.IsUser())
|
if (!subscriber.IsUser())
|
||||||
{
|
{
|
||||||
throw new GatewayException("In-app purchase is only allowed for users.");
|
throw new GatewayException("In-app purchase is only allowed for users.");
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ public class StripePaymentService : IPaymentService
|
|||||||
if (existingTransaction == null)
|
if (existingTransaction == null)
|
||||||
{
|
{
|
||||||
appleTransaction = verifiedAppleReceipt.BuildTransactionFromLastTransaction(
|
appleTransaction = verifiedAppleReceipt.BuildTransactionFromLastTransaction(
|
||||||
PremiumPlanAppleIapPrice, subcriber.Id);
|
PremiumPlanAppleIapPrice, subscriber.Id);
|
||||||
appleTransaction.Type = TransactionType.Charge;
|
appleTransaction.Type = TransactionType.Charge;
|
||||||
await _transactionRepository.CreateAsync(appleTransaction);
|
await _transactionRepository.CreateAsync(appleTransaction);
|
||||||
}
|
}
|
||||||
@ -595,12 +595,12 @@ public class StripePaymentService : IPaymentService
|
|||||||
SubmitForSettlement = true,
|
SubmitForSettlement = true,
|
||||||
PayPal = new Braintree.TransactionOptionsPayPalRequest
|
PayPal = new Braintree.TransactionOptionsPayPalRequest
|
||||||
{
|
{
|
||||||
CustomField = $"{subcriber.BraintreeIdField()}:{subcriber.Id}"
|
CustomField = $"{subscriber.BraintreeIdField()}:{subscriber.Id}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CustomFields = new Dictionary<string, string>
|
CustomFields = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
[subcriber.BraintreeIdField()] = subcriber.Id.ToString()
|
[subscriber.BraintreeIdField()] = subscriber.Id.ToString()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ public static class CoreHelpers
|
|||||||
return !invalid;
|
return !invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetApplicationCacheServiceBusSubcriptionName(GlobalSettings globalSettings)
|
public static string GetApplicationCacheServiceBusSubscriptionName(GlobalSettings globalSettings)
|
||||||
{
|
{
|
||||||
var subName = globalSettings.ServiceBus.ApplicationCacheSubscriptionName;
|
var subName = globalSettings.ServiceBus.ApplicationCacheSubscriptionName;
|
||||||
if (string.IsNullOrWhiteSpace(subName))
|
if (string.IsNullOrWhiteSpace(subName))
|
||||||
|
@ -181,7 +181,7 @@ public class CollectionCipherRepository : BaseEntityFrameworkRepository, ICollec
|
|||||||
using (var scope = ServiceScopeFactory.CreateScope())
|
using (var scope = ServiceScopeFactory.CreateScope())
|
||||||
{
|
{
|
||||||
var dbContext = GetDatabaseContext(scope);
|
var dbContext = GetDatabaseContext(scope);
|
||||||
var availibleCollections = from c in dbContext.Collections
|
var availableCollections = from c in dbContext.Collections
|
||||||
join o in dbContext.Organizations
|
join o in dbContext.Organizations
|
||||||
on c.OrganizationId equals o.Id
|
on c.OrganizationId equals o.Id
|
||||||
join ou in dbContext.OrganizationUsers
|
join ou in dbContext.OrganizationUsers
|
||||||
@ -205,15 +205,15 @@ public class CollectionCipherRepository : BaseEntityFrameworkRepository, ICollec
|
|||||||
(o.Id == organizationId && o.Enabled && ou.Status == OrganizationUserStatusType.Confirmed &&
|
(o.Id == organizationId && o.Enabled && ou.Status == OrganizationUserStatusType.Confirmed &&
|
||||||
(ou.AccessAll || !cu.ReadOnly || g.AccessAll || !cg.ReadOnly))
|
(ou.AccessAll || !cu.ReadOnly || g.AccessAll || !cg.ReadOnly))
|
||||||
select new { c, o, ou, cu, gu, g, cg };
|
select new { c, o, ou, cu, gu, g, cg };
|
||||||
var count = await availibleCollections.CountAsync();
|
var count = await availableCollections.CountAsync();
|
||||||
if (await availibleCollections.CountAsync() < 1)
|
if (await availableCollections.CountAsync() < 1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var insertData = from collectionId in collectionIds
|
var insertData = from collectionId in collectionIds
|
||||||
from cipherId in cipherIds
|
from cipherId in cipherIds
|
||||||
where availibleCollections.Select(x => x.c.Id).Contains(collectionId)
|
where availableCollections.Select(x => x.c.Id).Contains(collectionId)
|
||||||
select new Models.CollectionCipher
|
select new Models.CollectionCipher
|
||||||
{
|
{
|
||||||
CollectionId = collectionId,
|
CollectionId = collectionId,
|
||||||
|
@ -19,11 +19,11 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
|
|||||||
using (var scope = ServiceScopeFactory.CreateScope())
|
using (var scope = ServiceScopeFactory.CreateScope())
|
||||||
{
|
{
|
||||||
var dbContext = GetDatabaseContext(scope);
|
var dbContext = GetDatabaseContext(scope);
|
||||||
var availibleCollections = await (
|
var availableCollections = await (
|
||||||
from c in dbContext.Collections
|
from c in dbContext.Collections
|
||||||
where c.OrganizationId == grp.OrganizationId
|
where c.OrganizationId == grp.OrganizationId
|
||||||
select c).ToListAsync();
|
select c).ToListAsync();
|
||||||
var filteredCollections = collections.Where(c => availibleCollections.Any(a => c.Id == a.Id));
|
var filteredCollections = collections.Where(c => availableCollections.Any(a => c.Id == a.Id));
|
||||||
var collectionGroups = filteredCollections.Select(y => new CollectionGroup
|
var collectionGroups = filteredCollections.Select(y => new CollectionGroup
|
||||||
{
|
{
|
||||||
CollectionId = y.Id,
|
CollectionId = y.Id,
|
||||||
|
@ -22,11 +22,11 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
|
|||||||
using (var scope = ServiceScopeFactory.CreateScope())
|
using (var scope = ServiceScopeFactory.CreateScope())
|
||||||
{
|
{
|
||||||
var dbContext = GetDatabaseContext(scope);
|
var dbContext = GetDatabaseContext(scope);
|
||||||
var availibleCollections = await (
|
var availableCollections = await (
|
||||||
from c in dbContext.Collections
|
from c in dbContext.Collections
|
||||||
where c.OrganizationId == organizationUser.OrganizationId
|
where c.OrganizationId == organizationUser.OrganizationId
|
||||||
select c).ToListAsync();
|
select c).ToListAsync();
|
||||||
var filteredCollections = collections.Where(c => availibleCollections.Any(a => c.Id == a.Id));
|
var filteredCollections = collections.Where(c => availableCollections.Any(a => c.Id == a.Id));
|
||||||
var collectionUsers = filteredCollections.Select(y => new CollectionUser
|
var collectionUsers = filteredCollections.Select(y => new CollectionUser
|
||||||
{
|
{
|
||||||
CollectionId = y.Id,
|
CollectionId = y.Id,
|
||||||
|
@ -794,7 +794,7 @@ public class AccessPoliciesControllerTests : IClassFixture<ApiApplicationFactory
|
|||||||
[InlineData(PermissionType.RunAsUserWithPermission)]
|
[InlineData(PermissionType.RunAsUserWithPermission)]
|
||||||
public async Task GetServiceAccountAccessPolicies(PermissionType permissionType)
|
public async Task GetServiceAccountAccessPolicies(PermissionType permissionType)
|
||||||
{
|
{
|
||||||
var (org, owerOrgUser) = await _organizationHelper.Initialize(true, true);
|
var (org, ownerOrgUser) = await _organizationHelper.Initialize(true, true);
|
||||||
await LoginAsync(_email);
|
await LoginAsync(_email);
|
||||||
var initData = await SetupAccessPolicyRequest(org.Id);
|
var initData = await SetupAccessPolicyRequest(org.Id);
|
||||||
|
|
||||||
@ -820,7 +820,7 @@ public class AccessPoliciesControllerTests : IClassFixture<ApiApplicationFactory
|
|||||||
new UserServiceAccountAccessPolicy
|
new UserServiceAccountAccessPolicy
|
||||||
{
|
{
|
||||||
GrantedServiceAccountId = initData.ServiceAccountId,
|
GrantedServiceAccountId = initData.ServiceAccountId,
|
||||||
OrganizationUserId = owerOrgUser.Id,
|
OrganizationUserId = ownerOrgUser.Id,
|
||||||
Read = true,
|
Read = true,
|
||||||
Write = true,
|
Write = true,
|
||||||
},
|
},
|
||||||
@ -834,8 +834,8 @@ public class AccessPoliciesControllerTests : IClassFixture<ApiApplicationFactory
|
|||||||
|
|
||||||
Assert.NotNull(result?.UserAccessPolicies);
|
Assert.NotNull(result?.UserAccessPolicies);
|
||||||
Assert.NotEmpty(result!.UserAccessPolicies);
|
Assert.NotEmpty(result!.UserAccessPolicies);
|
||||||
Assert.Equal(owerOrgUser.Id,
|
Assert.Equal(ownerOrgUser.Id,
|
||||||
result.UserAccessPolicies.First(x => x.OrganizationUserId == owerOrgUser.Id).OrganizationUserId);
|
result.UserAccessPolicies.First(x => x.OrganizationUserId == ownerOrgUser.Id).OrganizationUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="AutoFixture.Xunit2" Version="$(AutoFixtureXUnit2Version)" />
|
<PackageReference Include="AutoFixture.Xunit2" Version="$(AutoFixtureXUnit2Version)" />
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="Moq" Version="4.17.2" />
|
<PackageReference Include="Moq" Version="4.17.2" />
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
@ -65,7 +65,7 @@ public class SetUpSponsorshipCommandTests : FamiliesForEnterpriseTestsBase
|
|||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[BitMemberAutoData(nameof(NonFamiliesPlanTypes))]
|
[BitMemberAutoData(nameof(NonFamiliesPlanTypes))]
|
||||||
public async Task SetUpSponsorship_OrgNotFamiles_ThrowsBadRequest(PlanType planType,
|
public async Task SetUpSponsorship_OrgNotFamilies_ThrowsBadRequest(PlanType planType,
|
||||||
OrganizationSponsorship sponsorship, Organization org,
|
OrganizationSponsorship sponsorship, Organization org,
|
||||||
SutProvider<SetUpSponsorshipCommand> sutProvider)
|
SutProvider<SetUpSponsorshipCommand> sutProvider)
|
||||||
{
|
{
|
||||||
|
@ -183,12 +183,12 @@ public class LocalAttachmentStorageServiceTests
|
|||||||
|
|
||||||
[Theory, BitAutoData]
|
[Theory, BitAutoData]
|
||||||
[UserCipherCustomize]
|
[UserCipherCustomize]
|
||||||
public async Task UserCipher_DeleteAttachmentsForCipherAsync_Succes(Cipher cipher) => await DeleteAttachmentsForCipherAsync_Succes(cipher);
|
public async Task UserCipher_DeleteAttachmentsForCipherAsync_Success(Cipher cipher) => await DeleteAttachmentsForCipherAsync_Success(cipher);
|
||||||
[Theory, BitAutoData]
|
[Theory, BitAutoData]
|
||||||
[OrganizationCipherCustomize]
|
[OrganizationCipherCustomize]
|
||||||
public async Task OrganizationCipher_DeleteAttachmentsForCipherAsync_Succes(Cipher cipher) => await DeleteAttachmentsForCipherAsync_Succes(cipher);
|
public async Task OrganizationCipher_DeleteAttachmentsForCipherAsync_Success(Cipher cipher) => await DeleteAttachmentsForCipherAsync_Success(cipher);
|
||||||
|
|
||||||
private async Task DeleteAttachmentsForCipherAsync_Succes(Cipher cipher)
|
private async Task DeleteAttachmentsForCipherAsync_Success(Cipher cipher)
|
||||||
{
|
{
|
||||||
using (var tempDirectory = new TempDirectory())
|
using (var tempDirectory = new TempDirectory())
|
||||||
{
|
{
|
||||||
|
@ -429,7 +429,7 @@ public class SendServiceTests
|
|||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[BitAutoData]
|
[BitAutoData]
|
||||||
public async void SaveFileSendAsync_HasEnouphStorage_Success(SutProvider<SendService> sutProvider,
|
public async void SaveFileSendAsync_HasEnoughStorage_Success(SutProvider<SendService> sutProvider,
|
||||||
Send send)
|
Send send)
|
||||||
{
|
{
|
||||||
var user = new User
|
var user = new User
|
||||||
@ -483,7 +483,7 @@ public class SendServiceTests
|
|||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[BitAutoData]
|
[BitAutoData]
|
||||||
public async void SaveFileSendAsync_HasEnouphStorage_SendFileThrows_CleansUp(SutProvider<SendService> sutProvider,
|
public async void SaveFileSendAsync_HasEnoughStorage_SendFileThrows_CleansUp(SutProvider<SendService> sutProvider,
|
||||||
Send send)
|
Send send)
|
||||||
{
|
{
|
||||||
var user = new User
|
var user = new User
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
@ -450,7 +450,7 @@ public class IdentityServerTests : IClassFixture<IdentityApplicationFactory>
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task TokenEndpoint_GrantTypeClientCredentials_AsInstallation_BadInsallationId_Fails()
|
public async Task TokenEndpoint_GrantTypeClientCredentials_AsInstallation_BadInstallationId_Fails()
|
||||||
{
|
{
|
||||||
var context = await _factory.Server.PostAsync("/connect/token", new FormUrlEncodedContent(new Dictionary<string, string>
|
var context = await _factory.Server.PostAsync("/connect/token", new FormUrlEncodedContent(new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.5" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
@ -24,7 +24,7 @@ public class EmergencyAccessRepositoryTests
|
|||||||
SqlRepo.UserRepository sqlUserRepo
|
SqlRepo.UserRepository sqlUserRepo
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var savedEmergencyAccesss = new List<EmergencyAccess>();
|
var savedEmergencyAccesses = new List<EmergencyAccess>();
|
||||||
foreach (var sut in suts)
|
foreach (var sut in suts)
|
||||||
{
|
{
|
||||||
var i = suts.IndexOf(sut);
|
var i = suts.IndexOf(sut);
|
||||||
@ -41,7 +41,7 @@ public class EmergencyAccessRepositoryTests
|
|||||||
sut.ClearChangeTracking();
|
sut.ClearChangeTracking();
|
||||||
|
|
||||||
var savedEmergencyAccess = await sut.GetByIdAsync(postEfEmergencyAccess.Id);
|
var savedEmergencyAccess = await sut.GetByIdAsync(postEfEmergencyAccess.Id);
|
||||||
savedEmergencyAccesss.Add(savedEmergencyAccess);
|
savedEmergencyAccesses.Add(savedEmergencyAccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < users.Count; j++)
|
for (int j = 0; j < users.Count; j++)
|
||||||
@ -53,9 +53,9 @@ public class EmergencyAccessRepositoryTests
|
|||||||
emergencyAccess.GranteeId = users[0].Id;
|
emergencyAccess.GranteeId = users[0].Id;
|
||||||
var sqlEmergencyAccess = await sqlEmergencyAccessRepo.CreateAsync(emergencyAccess);
|
var sqlEmergencyAccess = await sqlEmergencyAccessRepo.CreateAsync(emergencyAccess);
|
||||||
var savedSqlEmergencyAccess = await sqlEmergencyAccessRepo.GetByIdAsync(sqlEmergencyAccess.Id);
|
var savedSqlEmergencyAccess = await sqlEmergencyAccessRepo.GetByIdAsync(sqlEmergencyAccess.Id);
|
||||||
savedEmergencyAccesss.Add(savedSqlEmergencyAccess);
|
savedEmergencyAccesses.Add(savedSqlEmergencyAccess);
|
||||||
|
|
||||||
var distinctItems = savedEmergencyAccesss.Distinct(equalityComparer);
|
var distinctItems = savedEmergencyAccesses.Distinct(equalityComparer);
|
||||||
Assert.True(!distinctItems.Skip(1).Any());
|
Assert.True(!distinctItems.Skip(1).Any());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="Moq" Version="4.17.2" />
|
<PackageReference Include="Moq" Version="4.17.2" />
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstitueVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
@ -52,9 +52,9 @@ internal class CipherBuilder : ISpecimenBuilder
|
|||||||
{
|
{
|
||||||
var obj = fixture.WithAutoNSubstitutions().Create<Cipher>();
|
var obj = fixture.WithAutoNSubstitutions().Create<Cipher>();
|
||||||
var cipherData = fixture.WithAutoNSubstitutions().Create<CipherLoginData>();
|
var cipherData = fixture.WithAutoNSubstitutions().Create<CipherLoginData>();
|
||||||
var cipherAttachements = fixture.WithAutoNSubstitutions().Create<List<CipherAttachment>>();
|
var cipherAttachments = fixture.WithAutoNSubstitutions().Create<List<CipherAttachment>>();
|
||||||
obj.Data = JsonSerializer.Serialize(cipherData, serializerOptions);
|
obj.Data = JsonSerializer.Serialize(cipherData, serializerOptions);
|
||||||
obj.Attachments = JsonSerializer.Serialize(cipherAttachements, serializerOptions);
|
obj.Attachments = JsonSerializer.Serialize(cipherAttachments, serializerOptions);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -64,9 +64,9 @@ internal class CipherBuilder : ISpecimenBuilder
|
|||||||
for (var i = 0; i < ciphers.Count(); i++)
|
for (var i = 0; i < ciphers.Count(); i++)
|
||||||
{
|
{
|
||||||
var cipherData = fixture.WithAutoNSubstitutions().Create<CipherLoginData>();
|
var cipherData = fixture.WithAutoNSubstitutions().Create<CipherLoginData>();
|
||||||
var cipherAttachements = fixture.WithAutoNSubstitutions().Create<List<CipherAttachment>>();
|
var cipherAttachments = fixture.WithAutoNSubstitutions().Create<List<CipherAttachment>>();
|
||||||
ciphers[i].Data = JsonSerializer.Serialize(cipherData, serializerOptions);
|
ciphers[i].Data = JsonSerializer.Serialize(cipherData, serializerOptions);
|
||||||
ciphers[i].Attachments = JsonSerializer.Serialize(cipherAttachements, serializerOptions);
|
ciphers[i].Attachments = JsonSerializer.Serialize(cipherAttachments, serializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ciphers;
|
return ciphers;
|
||||||
|
@ -43,7 +43,7 @@ public class CipherRepositoryTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DatabaseTheory, DatabaseData]
|
[DatabaseTheory, DatabaseData]
|
||||||
public async Task CreateAsync_UpdateWithCollecitons_Works(
|
public async Task CreateAsync_UpdateWithCollections_Works(
|
||||||
IUserRepository userRepository,
|
IUserRepository userRepository,
|
||||||
IOrganizationRepository organizationRepository,
|
IOrganizationRepository organizationRepository,
|
||||||
IOrganizationUserRepository organizationUserRepository,
|
IOrganizationUserRepository organizationUserRepository,
|
||||||
|
Reference in New Issue
Block a user