2021-05-14 00:06:16 +02:00
|
|
|
|
using System;
|
2021-01-12 17:02:39 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using AutoFixture;
|
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
using Bit.Core.Models.Business;
|
|
|
|
|
using Bit.Core.Models.Data;
|
Postgres & MySql Support For Self-Hosted Installations (#1386)
* EF Database Support Init (#1221)
* scaffolding for ef support
* deleted old postgres repos
* added tables to oncreate
* updated all the things to .NET 5
* Addition to #1221: Migrated DockerFiles from dotnet/3.1 to 5.0 (#1223)
* Migrated DockerFiles from dotnet/3.1 to 5.0
* Migrated SSO/Dockerfile from dotnet 3.1 to 5.0
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* EFDatabaseSupport: Updated links and description in README.md and SETUP.md (#1232)
* Updated requirements in README.md
* Updated link to documentation of app-secrets
* upgraded dotnet version to 5.0
* Ef database support implementation examples (#1265)
* mostly finished testing the user repo
* finished testing user repo
* finished org, user, ssoconfig, and ssouser ef implementations
* removed unused prop
* fixed a sql file
* fixed a spacing issue
* fixed a spacing issue
* removed extra database creation
* refactoring
* MsSql => SqlServer
* refactoring
* code review fixes
* build fix
* code review
* continued attempts to fix the the build
* skipped another test
* finished all create test
* initial pass at several repos
* continued building out repos
* initial pass at several repos
* initial pass at device repo
* initial pass at collection repo
* initial run of all Entity Framework implementations
* signup, signin, create/edit ciphers works
* sync working
* all web vault pages seem to load with 100% 200s
* bulkcopy, folders, and favorites
* group and collection management
* sso, groups, emergency access, send
* get basic creates matching on all repos
* got everything building again post merge
* removed some IDE config files
* cleanup
* no more notimplemented methods in the cipher repo
* no more not implementeds everywhere
* cleaned up schema/navigation properties and fixed tests
* removed a sql comment that was written in c# style
* fixed build issues from merge
* removed unsupported db providers
* formatting
* code review refactors
* naming cleanup for queries
* added provider methods
* cipher repo cleanup
* implemented several missing procedures from the EF implementation surround account revision dates, keys, and storage
* fixed the build
* added a null check
* consolidated some cipher repo methods
* formatting fix
* cleaned up indentation of queries
* removed .idea file
* generated postgres migrations
* added mysql migrations
* formatting
* Bug Fixes & Formatting
* Formatting
* fixed a bug with bulk import when using MySql
* code review fixes
* fixed the build
* implemented new methods
* formatting
* fixed the build
* cleaned up select statements in ef queries
* formatting
* formatting
* formatting
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-07-08 18:35:48 +02:00
|
|
|
|
using TableModel = Bit.Core.Models.Table;
|
2021-01-12 17:02:39 +01:00
|
|
|
|
using Bit.Core.Utilities;
|
Postgres & MySql Support For Self-Hosted Installations (#1386)
* EF Database Support Init (#1221)
* scaffolding for ef support
* deleted old postgres repos
* added tables to oncreate
* updated all the things to .NET 5
* Addition to #1221: Migrated DockerFiles from dotnet/3.1 to 5.0 (#1223)
* Migrated DockerFiles from dotnet/3.1 to 5.0
* Migrated SSO/Dockerfile from dotnet 3.1 to 5.0
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* EFDatabaseSupport: Updated links and description in README.md and SETUP.md (#1232)
* Updated requirements in README.md
* Updated link to documentation of app-secrets
* upgraded dotnet version to 5.0
* Ef database support implementation examples (#1265)
* mostly finished testing the user repo
* finished testing user repo
* finished org, user, ssoconfig, and ssouser ef implementations
* removed unused prop
* fixed a sql file
* fixed a spacing issue
* fixed a spacing issue
* removed extra database creation
* refactoring
* MsSql => SqlServer
* refactoring
* code review fixes
* build fix
* code review
* continued attempts to fix the the build
* skipped another test
* finished all create test
* initial pass at several repos
* continued building out repos
* initial pass at several repos
* initial pass at device repo
* initial pass at collection repo
* initial run of all Entity Framework implementations
* signup, signin, create/edit ciphers works
* sync working
* all web vault pages seem to load with 100% 200s
* bulkcopy, folders, and favorites
* group and collection management
* sso, groups, emergency access, send
* get basic creates matching on all repos
* got everything building again post merge
* removed some IDE config files
* cleanup
* no more notimplemented methods in the cipher repo
* no more not implementeds everywhere
* cleaned up schema/navigation properties and fixed tests
* removed a sql comment that was written in c# style
* fixed build issues from merge
* removed unsupported db providers
* formatting
* code review refactors
* naming cleanup for queries
* added provider methods
* cipher repo cleanup
* implemented several missing procedures from the EF implementation surround account revision dates, keys, and storage
* fixed the build
* added a null check
* consolidated some cipher repo methods
* formatting fix
* cleaned up indentation of queries
* removed .idea file
* generated postgres migrations
* added mysql migrations
* formatting
* Bug Fixes & Formatting
* Formatting
* fixed a bug with bulk import when using MySql
* code review fixes
* fixed the build
* implemented new methods
* formatting
* fixed the build
* cleaned up select statements in ef queries
* formatting
* formatting
* formatting
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-07-08 18:35:48 +02:00
|
|
|
|
using AutoFixture.Kernel;
|
|
|
|
|
using Bit.Core.Models;
|
|
|
|
|
using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures;
|
|
|
|
|
using Bit.Core.Repositories.EntityFramework;
|
2021-10-29 21:05:45 +02:00
|
|
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|
|
|
|
using Bit.Test.Common.AutoFixture;
|
2021-01-12 17:02:39 +01:00
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.AutoFixture.OrganizationFixtures
|
|
|
|
|
{
|
2021-05-12 04:36:23 +02:00
|
|
|
|
public class Organization : ICustomization
|
|
|
|
|
{
|
|
|
|
|
public bool UseGroups { get; set; }
|
|
|
|
|
|
|
|
|
|
public void Customize(IFixture fixture)
|
|
|
|
|
{
|
|
|
|
|
var organizationId = Guid.NewGuid();
|
2021-06-01 17:13:08 +02:00
|
|
|
|
var maxConnections = (short)new Random().Next(10, short.MaxValue);
|
2021-05-12 04:36:23 +02:00
|
|
|
|
|
2021-05-14 00:06:16 +02:00
|
|
|
|
fixture.Customize<Core.Models.Table.Organization>(composer => composer
|
2021-05-12 04:36:23 +02:00
|
|
|
|
.With(o => o.Id, organizationId)
|
2021-06-01 17:13:08 +02:00
|
|
|
|
.With(o => o.MaxCollections, maxConnections)
|
2021-05-12 04:36:23 +02:00
|
|
|
|
.With(o => o.UseGroups, UseGroups));
|
|
|
|
|
|
2021-06-01 17:13:08 +02:00
|
|
|
|
fixture.Customize<Core.Models.Table.Collection>(composer =>
|
|
|
|
|
composer
|
|
|
|
|
.With(c => c.OrganizationId, organizationId));
|
|
|
|
|
|
Postgres & MySql Support For Self-Hosted Installations (#1386)
* EF Database Support Init (#1221)
* scaffolding for ef support
* deleted old postgres repos
* added tables to oncreate
* updated all the things to .NET 5
* Addition to #1221: Migrated DockerFiles from dotnet/3.1 to 5.0 (#1223)
* Migrated DockerFiles from dotnet/3.1 to 5.0
* Migrated SSO/Dockerfile from dotnet 3.1 to 5.0
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* EFDatabaseSupport: Updated links and description in README.md and SETUP.md (#1232)
* Updated requirements in README.md
* Updated link to documentation of app-secrets
* upgraded dotnet version to 5.0
* Ef database support implementation examples (#1265)
* mostly finished testing the user repo
* finished testing user repo
* finished org, user, ssoconfig, and ssouser ef implementations
* removed unused prop
* fixed a sql file
* fixed a spacing issue
* fixed a spacing issue
* removed extra database creation
* refactoring
* MsSql => SqlServer
* refactoring
* code review fixes
* build fix
* code review
* continued attempts to fix the the build
* skipped another test
* finished all create test
* initial pass at several repos
* continued building out repos
* initial pass at several repos
* initial pass at device repo
* initial pass at collection repo
* initial run of all Entity Framework implementations
* signup, signin, create/edit ciphers works
* sync working
* all web vault pages seem to load with 100% 200s
* bulkcopy, folders, and favorites
* group and collection management
* sso, groups, emergency access, send
* get basic creates matching on all repos
* got everything building again post merge
* removed some IDE config files
* cleanup
* no more notimplemented methods in the cipher repo
* no more not implementeds everywhere
* cleaned up schema/navigation properties and fixed tests
* removed a sql comment that was written in c# style
* fixed build issues from merge
* removed unsupported db providers
* formatting
* code review refactors
* naming cleanup for queries
* added provider methods
* cipher repo cleanup
* implemented several missing procedures from the EF implementation surround account revision dates, keys, and storage
* fixed the build
* added a null check
* consolidated some cipher repo methods
* formatting fix
* cleaned up indentation of queries
* removed .idea file
* generated postgres migrations
* added mysql migrations
* formatting
* Bug Fixes & Formatting
* Formatting
* fixed a bug with bulk import when using MySql
* code review fixes
* fixed the build
* implemented new methods
* formatting
* fixed the build
* cleaned up select statements in ef queries
* formatting
* formatting
* formatting
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-07-08 18:35:48 +02:00
|
|
|
|
fixture.Customize<TableModel.Group>(composer => composer.With(g => g.OrganizationId, organizationId));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class OrganizationBuilder: ISpecimenBuilder
|
|
|
|
|
{
|
|
|
|
|
public object Create(object request, ISpecimenContext context)
|
|
|
|
|
{
|
|
|
|
|
if (context == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(context));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var type = request as Type;
|
|
|
|
|
if (type == null || type != typeof(TableModel.Organization))
|
|
|
|
|
{
|
|
|
|
|
return new NoSpecimen();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var fixture = new Fixture();
|
|
|
|
|
var providers = fixture.Create<Dictionary<TwoFactorProviderType, TwoFactorProvider>>();
|
|
|
|
|
var organization = new Fixture().WithAutoNSubstitutions().Create<TableModel.Organization>();
|
|
|
|
|
organization.SetTwoFactorProviders(providers);
|
|
|
|
|
return organization;
|
2021-05-12 04:36:23 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-12 17:02:39 +01:00
|
|
|
|
internal class PaidOrganization : ICustomization
|
|
|
|
|
{
|
|
|
|
|
public PlanType CheckedPlanType { get; set; }
|
|
|
|
|
public void Customize(IFixture fixture)
|
|
|
|
|
{
|
2021-10-29 21:05:45 +02:00
|
|
|
|
var validUpgradePlans = StaticStore.Plans.Where(p => p.Type != PlanType.Free && !p.Disabled).Select(p => p.Type).ToList();
|
2021-01-12 17:02:39 +01:00
|
|
|
|
var lowestActivePaidPlan = validUpgradePlans.First();
|
2021-10-29 21:05:45 +02:00
|
|
|
|
CheckedPlanType = CheckedPlanType.Equals(PlanType.Free) ? lowestActivePaidPlan : CheckedPlanType;
|
2021-01-12 17:02:39 +01:00
|
|
|
|
validUpgradePlans.Remove(lowestActivePaidPlan);
|
2021-05-14 00:06:16 +02:00
|
|
|
|
fixture.Customize<Core.Models.Table.Organization>(composer => composer
|
2021-01-12 17:02:39 +01:00
|
|
|
|
.With(o => o.PlanType, CheckedPlanType));
|
|
|
|
|
fixture.Customize<OrganizationUpgrade>(composer => composer
|
Postgres & MySql Support For Self-Hosted Installations (#1386)
* EF Database Support Init (#1221)
* scaffolding for ef support
* deleted old postgres repos
* added tables to oncreate
* updated all the things to .NET 5
* Addition to #1221: Migrated DockerFiles from dotnet/3.1 to 5.0 (#1223)
* Migrated DockerFiles from dotnet/3.1 to 5.0
* Migrated SSO/Dockerfile from dotnet 3.1 to 5.0
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* EFDatabaseSupport: Updated links and description in README.md and SETUP.md (#1232)
* Updated requirements in README.md
* Updated link to documentation of app-secrets
* upgraded dotnet version to 5.0
* Ef database support implementation examples (#1265)
* mostly finished testing the user repo
* finished testing user repo
* finished org, user, ssoconfig, and ssouser ef implementations
* removed unused prop
* fixed a sql file
* fixed a spacing issue
* fixed a spacing issue
* removed extra database creation
* refactoring
* MsSql => SqlServer
* refactoring
* code review fixes
* build fix
* code review
* continued attempts to fix the the build
* skipped another test
* finished all create test
* initial pass at several repos
* continued building out repos
* initial pass at several repos
* initial pass at device repo
* initial pass at collection repo
* initial run of all Entity Framework implementations
* signup, signin, create/edit ciphers works
* sync working
* all web vault pages seem to load with 100% 200s
* bulkcopy, folders, and favorites
* group and collection management
* sso, groups, emergency access, send
* get basic creates matching on all repos
* got everything building again post merge
* removed some IDE config files
* cleanup
* no more notimplemented methods in the cipher repo
* no more not implementeds everywhere
* cleaned up schema/navigation properties and fixed tests
* removed a sql comment that was written in c# style
* fixed build issues from merge
* removed unsupported db providers
* formatting
* code review refactors
* naming cleanup for queries
* added provider methods
* cipher repo cleanup
* implemented several missing procedures from the EF implementation surround account revision dates, keys, and storage
* fixed the build
* added a null check
* consolidated some cipher repo methods
* formatting fix
* cleaned up indentation of queries
* removed .idea file
* generated postgres migrations
* added mysql migrations
* formatting
* Bug Fixes & Formatting
* Formatting
* fixed a bug with bulk import when using MySql
* code review fixes
* fixed the build
* implemented new methods
* formatting
* fixed the build
* cleaned up select statements in ef queries
* formatting
* formatting
* formatting
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-07-08 18:35:48 +02:00
|
|
|
|
.With(ou => ou.Plan, validUpgradePlans.First())) ;
|
2021-01-12 17:02:39 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-23 12:36:08 +02:00
|
|
|
|
internal class FreeOrganization : ICustomization
|
|
|
|
|
{
|
|
|
|
|
public void Customize(IFixture fixture)
|
|
|
|
|
{
|
|
|
|
|
fixture.Customize<Core.Models.Table.Organization>(composer => composer
|
|
|
|
|
.With(o => o.PlanType, PlanType.Free));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-12 17:02:39 +01:00
|
|
|
|
internal class FreeOrganizationUpgrade : ICustomization
|
|
|
|
|
{
|
|
|
|
|
public void Customize(IFixture fixture)
|
|
|
|
|
{
|
2021-05-14 00:06:16 +02:00
|
|
|
|
fixture.Customize<Core.Models.Table.Organization>(composer => composer
|
2021-01-12 17:02:39 +01:00
|
|
|
|
.With(o => o.PlanType, PlanType.Free));
|
|
|
|
|
|
|
|
|
|
var plansToIgnore = new List<PlanType> { PlanType.Free, PlanType.Custom };
|
2021-05-06 21:53:12 +02:00
|
|
|
|
var selectedPlan = StaticStore.Plans.Last(p => !plansToIgnore.Contains(p.Type) && !p.Disabled);
|
2021-06-01 17:13:08 +02:00
|
|
|
|
|
2021-01-12 17:02:39 +01:00
|
|
|
|
fixture.Customize<OrganizationUpgrade>(composer => composer
|
2021-05-06 21:53:12 +02:00
|
|
|
|
.With(ou => ou.Plan, selectedPlan.Type)
|
|
|
|
|
.With(ou => ou.PremiumAccessAddon, selectedPlan.HasPremiumAccessOption));
|
2021-05-14 00:06:16 +02:00
|
|
|
|
fixture.Customize<Core.Models.Table.Organization>(composer => composer
|
2021-01-12 17:02:39 +01:00
|
|
|
|
.Without(o => o.GatewaySubscriptionId));
|
|
|
|
|
}
|
|
|
|
|
}
|
Postgres & MySql Support For Self-Hosted Installations (#1386)
* EF Database Support Init (#1221)
* scaffolding for ef support
* deleted old postgres repos
* added tables to oncreate
* updated all the things to .NET 5
* Addition to #1221: Migrated DockerFiles from dotnet/3.1 to 5.0 (#1223)
* Migrated DockerFiles from dotnet/3.1 to 5.0
* Migrated SSO/Dockerfile from dotnet 3.1 to 5.0
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* EFDatabaseSupport: Updated links and description in README.md and SETUP.md (#1232)
* Updated requirements in README.md
* Updated link to documentation of app-secrets
* upgraded dotnet version to 5.0
* Ef database support implementation examples (#1265)
* mostly finished testing the user repo
* finished testing user repo
* finished org, user, ssoconfig, and ssouser ef implementations
* removed unused prop
* fixed a sql file
* fixed a spacing issue
* fixed a spacing issue
* removed extra database creation
* refactoring
* MsSql => SqlServer
* refactoring
* code review fixes
* build fix
* code review
* continued attempts to fix the the build
* skipped another test
* finished all create test
* initial pass at several repos
* continued building out repos
* initial pass at several repos
* initial pass at device repo
* initial pass at collection repo
* initial run of all Entity Framework implementations
* signup, signin, create/edit ciphers works
* sync working
* all web vault pages seem to load with 100% 200s
* bulkcopy, folders, and favorites
* group and collection management
* sso, groups, emergency access, send
* get basic creates matching on all repos
* got everything building again post merge
* removed some IDE config files
* cleanup
* no more notimplemented methods in the cipher repo
* no more not implementeds everywhere
* cleaned up schema/navigation properties and fixed tests
* removed a sql comment that was written in c# style
* fixed build issues from merge
* removed unsupported db providers
* formatting
* code review refactors
* naming cleanup for queries
* added provider methods
* cipher repo cleanup
* implemented several missing procedures from the EF implementation surround account revision dates, keys, and storage
* fixed the build
* added a null check
* consolidated some cipher repo methods
* formatting fix
* cleaned up indentation of queries
* removed .idea file
* generated postgres migrations
* added mysql migrations
* formatting
* Bug Fixes & Formatting
* Formatting
* fixed a bug with bulk import when using MySql
* code review fixes
* fixed the build
* implemented new methods
* formatting
* fixed the build
* cleaned up select statements in ef queries
* formatting
* formatting
* formatting
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-07-08 18:35:48 +02:00
|
|
|
|
|
2021-01-12 17:02:39 +01:00
|
|
|
|
internal class OrganizationInvite : ICustomization
|
|
|
|
|
{
|
|
|
|
|
public OrganizationUserType InviteeUserType { get; set; }
|
|
|
|
|
public OrganizationUserType InvitorUserType { get; set; }
|
|
|
|
|
public string PermissionsBlob { get; set; }
|
|
|
|
|
public void Customize(IFixture fixture)
|
|
|
|
|
{
|
|
|
|
|
var organizationId = new Guid();
|
|
|
|
|
PermissionsBlob = PermissionsBlob ?? JsonSerializer.Serialize(new Permissions(), new JsonSerializerOptions
|
|
|
|
|
{
|
|
|
|
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
|
|
|
|
});
|
2021-05-14 00:06:16 +02:00
|
|
|
|
fixture.Customize<Core.Models.Table.Organization>(composer => composer
|
2021-01-13 21:14:28 +01:00
|
|
|
|
.With(o => o.Id, organizationId)
|
|
|
|
|
.With(o => o.Seats, (short)100));
|
Postgres & MySql Support For Self-Hosted Installations (#1386)
* EF Database Support Init (#1221)
* scaffolding for ef support
* deleted old postgres repos
* added tables to oncreate
* updated all the things to .NET 5
* Addition to #1221: Migrated DockerFiles from dotnet/3.1 to 5.0 (#1223)
* Migrated DockerFiles from dotnet/3.1 to 5.0
* Migrated SSO/Dockerfile from dotnet 3.1 to 5.0
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* EFDatabaseSupport: Updated links and description in README.md and SETUP.md (#1232)
* Updated requirements in README.md
* Updated link to documentation of app-secrets
* upgraded dotnet version to 5.0
* Ef database support implementation examples (#1265)
* mostly finished testing the user repo
* finished testing user repo
* finished org, user, ssoconfig, and ssouser ef implementations
* removed unused prop
* fixed a sql file
* fixed a spacing issue
* fixed a spacing issue
* removed extra database creation
* refactoring
* MsSql => SqlServer
* refactoring
* code review fixes
* build fix
* code review
* continued attempts to fix the the build
* skipped another test
* finished all create test
* initial pass at several repos
* continued building out repos
* initial pass at several repos
* initial pass at device repo
* initial pass at collection repo
* initial run of all Entity Framework implementations
* signup, signin, create/edit ciphers works
* sync working
* all web vault pages seem to load with 100% 200s
* bulkcopy, folders, and favorites
* group and collection management
* sso, groups, emergency access, send
* get basic creates matching on all repos
* got everything building again post merge
* removed some IDE config files
* cleanup
* no more notimplemented methods in the cipher repo
* no more not implementeds everywhere
* cleaned up schema/navigation properties and fixed tests
* removed a sql comment that was written in c# style
* fixed build issues from merge
* removed unsupported db providers
* formatting
* code review refactors
* naming cleanup for queries
* added provider methods
* cipher repo cleanup
* implemented several missing procedures from the EF implementation surround account revision dates, keys, and storage
* fixed the build
* added a null check
* consolidated some cipher repo methods
* formatting fix
* cleaned up indentation of queries
* removed .idea file
* generated postgres migrations
* added mysql migrations
* formatting
* Bug Fixes & Formatting
* Formatting
* fixed a bug with bulk import when using MySql
* code review fixes
* fixed the build
* implemented new methods
* formatting
* fixed the build
* cleaned up select statements in ef queries
* formatting
* formatting
* formatting
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-07-08 18:35:48 +02:00
|
|
|
|
fixture.Customize<TableModel.OrganizationUser>(composer => composer
|
2021-01-12 17:02:39 +01:00
|
|
|
|
.With(ou => ou.OrganizationId, organizationId)
|
|
|
|
|
.With(ou => ou.Type, InvitorUserType)
|
|
|
|
|
.With(ou => ou.Permissions, PermissionsBlob));
|
|
|
|
|
fixture.Customize<OrganizationUserInvite>(composer => composer
|
|
|
|
|
.With(oi => oi.Type, InviteeUserType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Postgres & MySql Support For Self-Hosted Installations (#1386)
* EF Database Support Init (#1221)
* scaffolding for ef support
* deleted old postgres repos
* added tables to oncreate
* updated all the things to .NET 5
* Addition to #1221: Migrated DockerFiles from dotnet/3.1 to 5.0 (#1223)
* Migrated DockerFiles from dotnet/3.1 to 5.0
* Migrated SSO/Dockerfile from dotnet 3.1 to 5.0
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* EFDatabaseSupport: Updated links and description in README.md and SETUP.md (#1232)
* Updated requirements in README.md
* Updated link to documentation of app-secrets
* upgraded dotnet version to 5.0
* Ef database support implementation examples (#1265)
* mostly finished testing the user repo
* finished testing user repo
* finished org, user, ssoconfig, and ssouser ef implementations
* removed unused prop
* fixed a sql file
* fixed a spacing issue
* fixed a spacing issue
* removed extra database creation
* refactoring
* MsSql => SqlServer
* refactoring
* code review fixes
* build fix
* code review
* continued attempts to fix the the build
* skipped another test
* finished all create test
* initial pass at several repos
* continued building out repos
* initial pass at several repos
* initial pass at device repo
* initial pass at collection repo
* initial run of all Entity Framework implementations
* signup, signin, create/edit ciphers works
* sync working
* all web vault pages seem to load with 100% 200s
* bulkcopy, folders, and favorites
* group and collection management
* sso, groups, emergency access, send
* get basic creates matching on all repos
* got everything building again post merge
* removed some IDE config files
* cleanup
* no more notimplemented methods in the cipher repo
* no more not implementeds everywhere
* cleaned up schema/navigation properties and fixed tests
* removed a sql comment that was written in c# style
* fixed build issues from merge
* removed unsupported db providers
* formatting
* code review refactors
* naming cleanup for queries
* added provider methods
* cipher repo cleanup
* implemented several missing procedures from the EF implementation surround account revision dates, keys, and storage
* fixed the build
* added a null check
* consolidated some cipher repo methods
* formatting fix
* cleaned up indentation of queries
* removed .idea file
* generated postgres migrations
* added mysql migrations
* formatting
* Bug Fixes & Formatting
* Formatting
* fixed a bug with bulk import when using MySql
* code review fixes
* fixed the build
* implemented new methods
* formatting
* fixed the build
* cleaned up select statements in ef queries
* formatting
* formatting
* formatting
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-07-08 18:35:48 +02:00
|
|
|
|
internal class EfOrganization: ICustomization
|
|
|
|
|
{
|
|
|
|
|
public void Customize(IFixture fixture)
|
|
|
|
|
{
|
|
|
|
|
fixture.Customizations.Add(new IgnoreVirtualMembersCustomization());
|
|
|
|
|
fixture.Customizations.Add(new GlobalSettingsBuilder());
|
|
|
|
|
fixture.Customizations.Add(new OrganizationBuilder());
|
|
|
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<OrganizationRepository>());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-12 17:02:39 +01:00
|
|
|
|
internal class PaidOrganizationAutoDataAttribute : CustomAutoDataAttribute
|
|
|
|
|
{
|
2021-09-23 12:36:08 +02:00
|
|
|
|
public PaidOrganizationAutoDataAttribute(PlanType planType) : base(new SutProviderCustomization(),
|
|
|
|
|
new PaidOrganization { CheckedPlanType = planType })
|
2021-01-12 17:02:39 +01:00
|
|
|
|
{ }
|
2021-09-23 12:36:08 +02:00
|
|
|
|
public PaidOrganizationAutoDataAttribute(int planType = 0) : this((PlanType)planType) { }
|
2021-01-12 17:02:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class InlinePaidOrganizationAutoDataAttribute : InlineCustomAutoDataAttribute
|
|
|
|
|
{
|
2021-09-23 12:36:08 +02:00
|
|
|
|
public InlinePaidOrganizationAutoDataAttribute(PlanType planType, object[] values) : base(
|
|
|
|
|
new ICustomization[] { new SutProviderCustomization(), new PaidOrganization { CheckedPlanType = planType } }, values)
|
|
|
|
|
{ }
|
|
|
|
|
|
2021-01-12 17:02:39 +01:00
|
|
|
|
public InlinePaidOrganizationAutoDataAttribute(params object[] values) : base(new[] { typeof(SutProviderCustomization),
|
|
|
|
|
typeof(PaidOrganization) }, values)
|
|
|
|
|
{ }
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-23 12:36:08 +02:00
|
|
|
|
internal class InlineFreeOrganizationAutoDataAttribute : InlineCustomAutoDataAttribute
|
|
|
|
|
{
|
|
|
|
|
public InlineFreeOrganizationAutoDataAttribute(params object[] values) : base(new[] { typeof(SutProviderCustomization),
|
|
|
|
|
typeof(FreeOrganization) }, values)
|
|
|
|
|
{ }
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-12 17:02:39 +01:00
|
|
|
|
internal class FreeOrganizationUpgradeAutoDataAttribute : CustomAutoDataAttribute
|
|
|
|
|
{
|
|
|
|
|
public FreeOrganizationUpgradeAutoDataAttribute() : base(new SutProviderCustomization(), new FreeOrganizationUpgrade())
|
|
|
|
|
{ }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class InlineFreeOrganizationUpgradeAutoDataAttribute : InlineCustomAutoDataAttribute
|
|
|
|
|
{
|
|
|
|
|
public InlineFreeOrganizationUpgradeAutoDataAttribute(params object[] values) : base(new[] { typeof(SutProviderCustomization),
|
|
|
|
|
typeof(FreeOrganizationUpgrade) }, values)
|
|
|
|
|
{ }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class OrganizationInviteAutoDataAttribute : CustomAutoDataAttribute
|
|
|
|
|
{
|
|
|
|
|
public OrganizationInviteAutoDataAttribute(int inviteeUserType = 0, int invitorUserType = 0, string permissionsBlob = null) : base(new SutProviderCustomization(),
|
2021-05-12 04:36:23 +02:00
|
|
|
|
new OrganizationInvite
|
|
|
|
|
{
|
|
|
|
|
InviteeUserType = (OrganizationUserType)inviteeUserType,
|
|
|
|
|
InvitorUserType = (OrganizationUserType)invitorUserType,
|
2021-01-12 17:02:39 +01:00
|
|
|
|
PermissionsBlob = permissionsBlob,
|
|
|
|
|
})
|
|
|
|
|
{ }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class InlineOrganizationInviteAutoDataAttribute : InlineCustomAutoDataAttribute
|
|
|
|
|
{
|
|
|
|
|
public InlineOrganizationInviteAutoDataAttribute(params object[] values) : base(new[] { typeof(SutProviderCustomization),
|
|
|
|
|
typeof(OrganizationInvite) }, values)
|
|
|
|
|
{ }
|
|
|
|
|
}
|
Postgres & MySql Support For Self-Hosted Installations (#1386)
* EF Database Support Init (#1221)
* scaffolding for ef support
* deleted old postgres repos
* added tables to oncreate
* updated all the things to .NET 5
* Addition to #1221: Migrated DockerFiles from dotnet/3.1 to 5.0 (#1223)
* Migrated DockerFiles from dotnet/3.1 to 5.0
* Migrated SSO/Dockerfile from dotnet 3.1 to 5.0
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* EFDatabaseSupport: Updated links and description in README.md and SETUP.md (#1232)
* Updated requirements in README.md
* Updated link to documentation of app-secrets
* upgraded dotnet version to 5.0
* Ef database support implementation examples (#1265)
* mostly finished testing the user repo
* finished testing user repo
* finished org, user, ssoconfig, and ssouser ef implementations
* removed unused prop
* fixed a sql file
* fixed a spacing issue
* fixed a spacing issue
* removed extra database creation
* refactoring
* MsSql => SqlServer
* refactoring
* code review fixes
* build fix
* code review
* continued attempts to fix the the build
* skipped another test
* finished all create test
* initial pass at several repos
* continued building out repos
* initial pass at several repos
* initial pass at device repo
* initial pass at collection repo
* initial run of all Entity Framework implementations
* signup, signin, create/edit ciphers works
* sync working
* all web vault pages seem to load with 100% 200s
* bulkcopy, folders, and favorites
* group and collection management
* sso, groups, emergency access, send
* get basic creates matching on all repos
* got everything building again post merge
* removed some IDE config files
* cleanup
* no more notimplemented methods in the cipher repo
* no more not implementeds everywhere
* cleaned up schema/navigation properties and fixed tests
* removed a sql comment that was written in c# style
* fixed build issues from merge
* removed unsupported db providers
* formatting
* code review refactors
* naming cleanup for queries
* added provider methods
* cipher repo cleanup
* implemented several missing procedures from the EF implementation surround account revision dates, keys, and storage
* fixed the build
* added a null check
* consolidated some cipher repo methods
* formatting fix
* cleaned up indentation of queries
* removed .idea file
* generated postgres migrations
* added mysql migrations
* formatting
* Bug Fixes & Formatting
* Formatting
* fixed a bug with bulk import when using MySql
* code review fixes
* fixed the build
* implemented new methods
* formatting
* fixed the build
* cleaned up select statements in ef queries
* formatting
* formatting
* formatting
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-07-08 18:35:48 +02:00
|
|
|
|
|
|
|
|
|
internal class EfOrganizationAutoDataAttribute : CustomAutoDataAttribute
|
|
|
|
|
{
|
|
|
|
|
public EfOrganizationAutoDataAttribute() : base(new SutProviderCustomization(), new EfOrganization())
|
|
|
|
|
{ }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class InlineEfOrganizationAutoDataAttribute : InlineCustomAutoDataAttribute
|
|
|
|
|
{
|
|
|
|
|
public InlineEfOrganizationAutoDataAttribute(params object[] values) : base(new[] { typeof(SutProviderCustomization),
|
|
|
|
|
typeof(EfOrganization) }, values)
|
|
|
|
|
{ }
|
|
|
|
|
}
|
2021-01-12 17:02:39 +01:00
|
|
|
|
}
|