1
0
mirror of https://github.com/bitwarden/server synced 2025-12-24 04:03:25 +00:00

Merge branch 'main' into SM-1571-DisableSMAdsForUsers

This commit is contained in:
cd-bitwarden
2025-10-22 12:28:04 -04:00
committed by GitHub
295 changed files with 42165 additions and 4881 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,69 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class CreatingSecretVersionTables : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SecretVersion",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
SecretId = table.Column<Guid>(type: "uuid", nullable: false),
Value = table.Column<string>(type: "text", nullable: false),
VersionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
EditorServiceAccountId = table.Column<Guid>(type: "uuid", nullable: true),
EditorOrganizationUserId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SecretVersion", x => x.Id);
table.ForeignKey(
name: "FK_SecretVersion_OrganizationUser_EditorOrganizationUserId",
column: x => x.EditorOrganizationUserId,
principalTable: "OrganizationUser",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_SecretVersion_Secret_SecretId",
column: x => x.SecretId,
principalTable: "Secret",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SecretVersion_ServiceAccount_EditorServiceAccountId",
column: x => x.EditorServiceAccountId,
principalTable: "ServiceAccount",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateIndex(
name: "IX_SecretVersion_EditorOrganizationUserId",
table: "SecretVersion",
column: "EditorOrganizationUserId");
migrationBuilder.CreateIndex(
name: "IX_SecretVersion_EditorServiceAccountId",
table: "SecretVersion",
column: "EditorServiceAccountId");
migrationBuilder.CreateIndex(
name: "IX_SecretVersion_SecretId",
table: "SecretVersion",
column: "SecretId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SecretVersion");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class AddAutoConfirmUserToOrg : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UseAutomaticUserConfirmation",
table: "Organization",
type: "boolean",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseAutomaticUserConfirmation",
table: "Organization");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class UserCryptoV2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SecurityState",
table: "User",
type: "text",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "SecurityVersion",
table: "User",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SignedPublicKey",
table: "User",
type: "text",
nullable: true);
migrationBuilder.CreateTable(
name: "UserSignatureKeyPair",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
SignatureAlgorithm = table.Column<byte>(type: "smallint", nullable: false),
VerifyingKey = table.Column<string>(type: "text", nullable: false),
SigningKey = table.Column<string>(type: "text", nullable: false),
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserSignatureKeyPair", x => x.Id);
table.ForeignKey(
name: "FK_UserSignatureKeyPair_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_UserSignatureKeyPair_UserId",
table: "UserSignatureKeyPair",
column: "UserId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "UserSignatureKeyPair");
migrationBuilder.DropColumn(
name: "SecurityState",
table: "User");
migrationBuilder.DropColumn(
name: "SecurityVersion",
table: "User");
migrationBuilder.DropColumn(
name: "SignedPublicKey",
table: "User");
}
}

View File

@@ -225,6 +225,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<bool>("UseApi")
.HasColumnType("boolean");
b.Property<bool>("UseAutomaticUserConfirmation")
.HasColumnType("boolean");
b.Property<bool>("UseCustomPermissions")
.HasColumnType("boolean");
@@ -1882,6 +1885,15 @@ namespace Bit.PostgresMigrations.Migrations
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("SecurityState")
.HasColumnType("text");
b.Property<int?>("SecurityVersion")
.HasColumnType("integer");
b.Property<string>("SignedPublicKey")
.HasColumnType("text");
b.Property<long?>("Storage")
.HasColumnType("bigint");
@@ -1910,6 +1922,40 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("User", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserSignatureKeyPair", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
b.Property<DateTime>("CreationDate")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("RevisionDate")
.HasColumnType("timestamp with time zone");
b.Property<byte>("SignatureAlgorithm")
.HasColumnType("smallint");
b.Property<string>("SigningKey")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<string>("VerifyingKey")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique()
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("UserSignatureKeyPair", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.NotificationCenter.Models.Notification", b =>
{
b.Property<Guid>("Id")
@@ -2168,6 +2214,42 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Secret", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.SecretsManager.Models.SecretVersion", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
b.Property<Guid?>("EditorOrganizationUserId")
.HasColumnType("uuid");
b.Property<Guid?>("EditorServiceAccountId")
.HasColumnType("uuid");
b.Property<Guid>("SecretId")
.HasColumnType("uuid");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("VersionDate")
.HasColumnType("timestamp with time zone");
b.HasKey("Id")
.HasAnnotation("SqlServer:Clustered", true);
b.HasIndex("EditorOrganizationUserId")
.HasDatabaseName("IX_SecretVersion_EditorOrganizationUserId");
b.HasIndex("EditorServiceAccountId")
.HasDatabaseName("IX_SecretVersion_EditorServiceAccountId");
b.HasIndex("SecretId")
.HasDatabaseName("IX_SecretVersion_SecretId");
b.ToTable("SecretVersion");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount", b =>
{
b.Property<Guid>("Id")
@@ -2921,6 +3003,17 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserSignatureKeyPair", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.NotificationCenter.Models.Notification", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
@@ -2993,6 +3086,31 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.SecretsManager.Models.SecretVersion", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "EditorOrganizationUser")
.WithMany()
.HasForeignKey("EditorOrganizationUserId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount", "EditorServiceAccount")
.WithMany()
.HasForeignKey("EditorServiceAccountId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret", "Secret")
.WithMany("SecretVersions")
.HasForeignKey("SecretId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EditorOrganizationUser");
b.Navigation("EditorServiceAccount");
b.Navigation("Secret");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
@@ -3264,6 +3382,8 @@ namespace Bit.PostgresMigrations.Migrations
{
b.Navigation("GroupAccessPolicies");
b.Navigation("SecretVersions");
b.Navigation("ServiceAccountAccessPolicies");
b.Navigation("UserAccessPolicies");