1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-29 13:25:17 +01:00
bitwarden-server/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/OrganizationCompare.cs
Rui Tomé ae280a313c
[EC-343] Gate custom permissions behind enterprise plan (#2352)
* [EC-343] Added column 'UseCustomPermissions' to Organization table

* [EC-343] Added 'UseCustomPermissions' to Api responses

* [EC-343] Added 'UseCustomPermissions' to Admin view

* [EC-343] Add constraint to Organization table to have default UseCustomPermissions value

* [EC-343] Recreate OrganizationView to include UseCustomPermissions column

* [EC-343] Add MySql EF migrations

* [EC-343] Add Postgres EF migrations

* Revert "[EC-343] Add Postgres EF migrations"

This reverts commit 8f1654cb7d.

* [EC-343] Add Postgres migrations and script

* [EC-343] dotnet format

* [EC-343] Set 'Custom Permissions' feature as unchecked for teams plan

* [EC-343] Add CustomPermissions to plan upgrades

* [EC-343] Update CURRENT_LICENSE_FILE_VERSION

* [EC-343] Enable 'Custom Permissions' on Enterprise 2019 plan

* [EC-343] Updated migration script to include Enterprise 2019 plan

* [EC-343] Update CURRENT_LICENSE_FILE_VERSION to 10

* [EC-343] Move logic checking if Organization can use custom permissions to OrganizationService

* [EC-343] Add unit tests to validate UseCustomPermissions check

* [EC-343] Revert UseCustomPermissionsFlag migration

* [EC-343] Fix typo in OrganizationUserOrganizationDetailsViewQuery

* [EC-343] Add Postgres migrations without affecting other datetime column

* [EC-343] Create ValidateOrganizationCustomPermissionsEnabledAsync. Add more unit tests around CustomPermissions check

* [EC-343] Add curly brackets to if condition

* [EC-343] Rename unit tests
2022-12-06 09:50:08 +00:00

55 lines
2.4 KiB
C#

using System.Diagnostics.CodeAnalysis;
using Bit.Core.Entities;
namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers;
public class OrganizationCompare : IEqualityComparer<Organization>
{
public bool Equals(Organization x, Organization y)
{
var a = x.ExpirationDate.ToString();
var b = y.ExpirationDate.ToString();
return x.Identifier.Equals(y.Identifier) &&
x.Name.Equals(y.Name) &&
x.BusinessName.Equals(y.BusinessName) &&
x.BusinessAddress1.Equals(y.BusinessAddress1) &&
x.BusinessAddress2.Equals(y.BusinessAddress2) &&
x.BusinessAddress3.Equals(y.BusinessAddress3) &&
x.BusinessCountry.Equals(y.BusinessCountry) &&
x.BusinessTaxNumber.Equals(y.BusinessTaxNumber) &&
x.BillingEmail.Equals(y.BillingEmail) &&
x.Plan.Equals(y.Plan) &&
x.PlanType.Equals(y.PlanType) &&
x.Seats.Equals(y.Seats) &&
x.MaxCollections.Equals(y.MaxCollections) &&
x.UsePolicies.Equals(y.UsePolicies) &&
x.UseSso.Equals(y.UseSso) &&
x.UseKeyConnector.Equals(y.UseKeyConnector) &&
x.UseScim.Equals(y.UseScim) &&
x.UseGroups.Equals(y.UseGroups) &&
x.UseDirectory.Equals(y.UseDirectory) &&
x.UseEvents.Equals(y.UseEvents) &&
x.UseTotp.Equals(y.UseTotp) &&
x.Use2fa.Equals(y.Use2fa) &&
x.UseApi.Equals(y.UseApi) &&
x.SelfHost.Equals(y.SelfHost) &&
x.UsersGetPremium.Equals(y.UsersGetPremium) &&
x.UseCustomPermissions.Equals(y.UseCustomPermissions) &&
x.Storage.Equals(y.Storage) &&
x.MaxStorageGb.Equals(y.MaxStorageGb) &&
x.Gateway.Equals(y.Gateway) &&
x.GatewayCustomerId.Equals(y.GatewayCustomerId) &&
x.GatewaySubscriptionId.Equals(y.GatewaySubscriptionId) &&
x.ReferenceData.Equals(y.ReferenceData) &&
x.Enabled.Equals(y.Enabled) &&
x.LicenseKey.Equals(y.LicenseKey) &&
x.TwoFactorProviders.Equals(y.TwoFactorProviders) &&
x.ExpirationDate.ToString().Equals(y.ExpirationDate.ToString());
}
public int GetHashCode([DisallowNull] Organization obj)
{
return base.GetHashCode();
}
}