1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Organization autoscaling (#1585)

* Add autoscale fields to Organization

* Add autoscale setting changes

* Autoscale organizations

updates InviteUsersAsync to support all invite sources.

sends an email to org owners when organization autoscaled

* All organizations autoscale

Disabling autoscaling can be done by setting max seats to current seats.

We only warn about autoscaling on the first autoscaling event.

* Fix tests

* Bug fixes

* Simplify subscription update logic

* Void invoices that fail to delete

Stripe no longer allows deletion of draft invoices that were created as part of subscription updates. It's necessary to void out these invoices without sending tem to the client.

* Notify org owners when their subscription runs out of seats

* Use datetime for notifications

Allows for later re-sending email if we want to periodically remind
owners

* Do not update subscription if it already matches new quatity

* Include all migrations

* Remove unnecessary inline styling

* SubscriptionUpdate handles update decisions

* Remove unnecessary html setter

* PR review

* Use minimum access for class methods
This commit is contained in:
Matt Gibson
2021-09-23 06:36:08 -04:00
committed by GitHub
parent c2d5106a4d
commit d39f45c81c
46 changed files with 4113 additions and 231 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations
{
public partial class AddMaxAutoscaleSeatsToOrganization : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "MaxAutoscaleSeats",
table: "Organization",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "OwnersNotifiedOfAutoscaling",
table: "Organization",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ProviderOrganizationId",
table: "Event",
type: "uuid",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MaxAutoscaleSeats",
table: "Organization");
migrationBuilder.DropColumn(
name: "OwnersNotifiedOfAutoscaling",
table: "Organization");
migrationBuilder.DropColumn(
name: "ProviderOrganizationId",
table: "Event");
}
}
}

View File

@ -17,7 +17,7 @@ namespace Bit.PostgresMigrations.Migrations
modelBuilder
.HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False")
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.5")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Cipher", b =>
@ -281,6 +281,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<Guid?>("ProviderId")
.HasColumnType("uuid");
b.Property<Guid?>("ProviderOrganizationId")
.HasColumnType("uuid");
b.Property<Guid?>("ProviderUserId")
.HasColumnType("uuid");
@ -504,6 +507,9 @@ namespace Bit.PostgresMigrations.Migrations
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int?>("MaxAutoscaleSeats")
.HasColumnType("integer");
b.Property<short?>("MaxCollections")
.HasColumnType("smallint");
@ -514,6 +520,9 @@ namespace Bit.PostgresMigrations.Migrations
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime?>("OwnersNotifiedOfAutoscaling")
.HasColumnType("timestamp without time zone");
b.Property<string>("Plan")
.HasMaxLength(50)
.HasColumnType("character varying(50)");