mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[SM-394] Secrets Manager (#2164)
Long lived feature branch for Secrets Manager Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com> Co-authored-by: cd-bitwarden <106776772+cd-bitwarden@users.noreply.github.com> Co-authored-by: CarleyDiaz-Bitwarden <103955722+CarleyDiaz-Bitwarden@users.noreply.github.com> Co-authored-by: Thomas Avery <tavery@bitwarden.com> Co-authored-by: Colton Hurst <colton@coltonhurst.com>
This commit is contained in:
2118
util/MySqlMigrations/Migrations/20230106122006_SecretsManager.Designer.cs
generated
Normal file
2118
util/MySqlMigrations/Migrations/20230106122006_SecretsManager.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
282
util/MySqlMigrations/Migrations/20230106122006_SecretsManager.cs
Normal file
282
util/MySqlMigrations/Migrations/20230106122006_SecretsManager.cs
Normal file
@ -0,0 +1,282 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
public partial class SecretsManager : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "UseSecretsManager",
|
||||
table: "Organization",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Project",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OrganizationId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
RevisionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
DeletedDate = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Project", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Project_Organization_OrganizationId",
|
||||
column: x => x.OrganizationId,
|
||||
principalTable: "Organization",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Secret",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OrganizationId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Key = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Value = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Note = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
RevisionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
DeletedDate = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Secret", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Secret_Organization_OrganizationId",
|
||||
column: x => x.OrganizationId,
|
||||
principalTable: "Organization",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ServiceAccount",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OrganizationId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
RevisionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ServiceAccount", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ServiceAccount_Organization_OrganizationId",
|
||||
column: x => x.OrganizationId,
|
||||
principalTable: "Organization",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProjectSecret",
|
||||
columns: table => new
|
||||
{
|
||||
ProjectsId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
SecretsId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProjectSecret", x => new { x.ProjectsId, x.SecretsId });
|
||||
table.ForeignKey(
|
||||
name: "FK_ProjectSecret_Project_ProjectsId",
|
||||
column: x => x.ProjectsId,
|
||||
principalTable: "Project",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProjectSecret_Secret_SecretsId",
|
||||
column: x => x.SecretsId,
|
||||
principalTable: "Secret",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AccessPolicy",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
GroupId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
GrantedProjectId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
GrantedServiceAccountId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
ServiceAccountId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
OrganizationUserId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
Read = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Write = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
RevisionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
Discriminator = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AccessPolicy", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AccessPolicy_Group_GroupId",
|
||||
column: x => x.GroupId,
|
||||
principalTable: "Group",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_AccessPolicy_OrganizationUser_OrganizationUserId",
|
||||
column: x => x.OrganizationUserId,
|
||||
principalTable: "OrganizationUser",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_AccessPolicy_Project_GrantedProjectId",
|
||||
column: x => x.GrantedProjectId,
|
||||
principalTable: "Project",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId",
|
||||
column: x => x.GrantedServiceAccountId,
|
||||
principalTable: "ServiceAccount",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_AccessPolicy_ServiceAccount_ServiceAccountId",
|
||||
column: x => x.ServiceAccountId,
|
||||
principalTable: "ServiceAccount",
|
||||
principalColumn: "Id");
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ApiKey",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ServiceAccountId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ClientSecret = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Scope = table.Column<string>(type: "varchar(4000)", maxLength: 4000, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
EncryptedPayload = table.Column<string>(type: "varchar(4000)", maxLength: 4000, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Key = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ExpireAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
RevisionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApiKey", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ApiKey_ServiceAccount_ServiceAccountId",
|
||||
column: x => x.ServiceAccountId,
|
||||
principalTable: "ServiceAccount",
|
||||
principalColumn: "Id");
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccessPolicy_GrantedProjectId",
|
||||
table: "AccessPolicy",
|
||||
column: "GrantedProjectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccessPolicy_GrantedServiceAccountId",
|
||||
table: "AccessPolicy",
|
||||
column: "GrantedServiceAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccessPolicy_GroupId",
|
||||
table: "AccessPolicy",
|
||||
column: "GroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccessPolicy_OrganizationUserId",
|
||||
table: "AccessPolicy",
|
||||
column: "OrganizationUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccessPolicy_ServiceAccountId",
|
||||
table: "AccessPolicy",
|
||||
column: "ServiceAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApiKey_ServiceAccountId",
|
||||
table: "ApiKey",
|
||||
column: "ServiceAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Project_DeletedDate",
|
||||
table: "Project",
|
||||
column: "DeletedDate");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Project_OrganizationId",
|
||||
table: "Project",
|
||||
column: "OrganizationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjectSecret_SecretsId",
|
||||
table: "ProjectSecret",
|
||||
column: "SecretsId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Secret_DeletedDate",
|
||||
table: "Secret",
|
||||
column: "DeletedDate");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Secret_OrganizationId",
|
||||
table: "Secret",
|
||||
column: "OrganizationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ServiceAccount_OrganizationId",
|
||||
table: "ServiceAccount",
|
||||
column: "OrganizationId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AccessPolicy");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ApiKey");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProjectSecret");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ServiceAccount");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Project");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Secret");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UseSecretsManager",
|
||||
table: "Organization");
|
||||
}
|
||||
}
|
@ -16,9 +16,83 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.4")
|
||||
.HasAnnotation("ProductVersion", "6.0.12")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AccessPolicy", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("Read")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Write")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasAnnotation("SqlServer:Clustered", true);
|
||||
|
||||
b.ToTable("AccessPolicy", (string)null);
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("AccessPolicy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("ClientSecret")
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("varchar(30)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("EncryptedPayload")
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("varchar(4000)");
|
||||
|
||||
b.Property<DateTime?>("ExpireAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Scope")
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("varchar(4000)");
|
||||
|
||||
b.Property<Guid?>("ServiceAccountId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasAnnotation("SqlServer:Clustered", true);
|
||||
|
||||
b.HasIndex("ServiceAccountId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("ApiKey", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@ -646,6 +720,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Property<bool>("UseScim")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("UseSecretsManager")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("UseSso")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
@ -834,6 +911,38 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.ToTable("Policy", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("DeletedDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasAnnotation("SqlServer:Clustered", true);
|
||||
|
||||
b.HasIndex("DeletedDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Project", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@ -956,6 +1065,44 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.ToTable("ProviderUser", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("DeletedDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasAnnotation("SqlServer:Clustered", true);
|
||||
|
||||
b.HasIndex("DeletedDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Secret", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@ -1013,6 +1160,32 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.ToTable("Send", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasAnnotation("SqlServer:Clustered", true);
|
||||
|
||||
b.HasIndex("OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("ServiceAccount", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -1280,6 +1453,134 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.ToTable("User", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProjectSecret", b =>
|
||||
{
|
||||
b.Property<Guid>("ProjectsId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("SecretsId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("ProjectsId", "SecretsId");
|
||||
|
||||
b.HasIndex("SecretsId");
|
||||
|
||||
b.ToTable("ProjectSecret");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupProjectAccessPolicy", b =>
|
||||
{
|
||||
b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy");
|
||||
|
||||
b.Property<Guid?>("GrantedProjectId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("GrantedProjectId");
|
||||
|
||||
b.Property<Guid?>("GroupId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("GroupId");
|
||||
|
||||
b.HasIndex("GrantedProjectId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasDiscriminator().HasValue("group_project");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupServiceAccountAccessPolicy", b =>
|
||||
{
|
||||
b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy");
|
||||
|
||||
b.Property<Guid?>("GrantedServiceAccountId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("GrantedServiceAccountId");
|
||||
|
||||
b.Property<Guid?>("GroupId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("GroupId");
|
||||
|
||||
b.HasIndex("GrantedServiceAccountId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasDiscriminator().HasValue("group_service_account");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccountProjectAccessPolicy", b =>
|
||||
{
|
||||
b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy");
|
||||
|
||||
b.Property<Guid?>("GrantedProjectId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("GrantedProjectId");
|
||||
|
||||
b.Property<Guid?>("ServiceAccountId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("ServiceAccountId");
|
||||
|
||||
b.HasIndex("GrantedProjectId");
|
||||
|
||||
b.HasIndex("ServiceAccountId");
|
||||
|
||||
b.HasDiscriminator().HasValue("service_account_project");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserProjectAccessPolicy", b =>
|
||||
{
|
||||
b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy");
|
||||
|
||||
b.Property<Guid?>("GrantedProjectId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("GrantedProjectId");
|
||||
|
||||
b.Property<Guid?>("OrganizationUserId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("OrganizationUserId");
|
||||
|
||||
b.HasIndex("GrantedProjectId");
|
||||
|
||||
b.HasIndex("OrganizationUserId");
|
||||
|
||||
b.HasDiscriminator().HasValue("user_project");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserServiceAccountAccessPolicy", b =>
|
||||
{
|
||||
b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy");
|
||||
|
||||
b.Property<Guid?>("GrantedServiceAccountId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("GrantedServiceAccountId");
|
||||
|
||||
b.Property<Guid?>("OrganizationUserId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("OrganizationUserId");
|
||||
|
||||
b.HasIndex("GrantedServiceAccountId");
|
||||
|
||||
b.HasIndex("OrganizationUserId");
|
||||
|
||||
b.HasDiscriminator().HasValue("user_service_account");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("ServiceAccountId");
|
||||
|
||||
b.Navigation("ServiceAccount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice")
|
||||
@ -1522,6 +1823,17 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Navigation("Organization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Organization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
|
||||
@ -1558,6 +1870,17 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Organization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
|
||||
@ -1573,6 +1896,17 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Organization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
|
||||
@ -1616,6 +1950,96 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProjectSecret", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ProjectsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Secret", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("SecretsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupProjectAccessPolicy", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject")
|
||||
.WithMany("GroupAccessPolicies")
|
||||
.HasForeignKey("GrantedProjectId");
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group")
|
||||
.WithMany()
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("GrantedProject");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupServiceAccountAccessPolicy", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "GrantedServiceAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("GrantedServiceAccountId");
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group")
|
||||
.WithMany()
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("GrantedServiceAccount");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccountProjectAccessPolicy", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject")
|
||||
.WithMany("ServiceAccountAccessPolicies")
|
||||
.HasForeignKey("GrantedProjectId");
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("ServiceAccountId");
|
||||
|
||||
b.Navigation("GrantedProject");
|
||||
|
||||
b.Navigation("ServiceAccount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserProjectAccessPolicy", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject")
|
||||
.WithMany("UserAccessPolicies")
|
||||
.HasForeignKey("GrantedProjectId");
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationUserId");
|
||||
|
||||
b.Navigation("GrantedProject");
|
||||
|
||||
b.Navigation("OrganizationUser");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserServiceAccountAccessPolicy", b =>
|
||||
{
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "GrantedServiceAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("GrantedServiceAccountId");
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationUserId");
|
||||
|
||||
b.Navigation("GrantedServiceAccount");
|
||||
|
||||
b.Navigation("OrganizationUser");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
|
||||
{
|
||||
b.Navigation("CollectionCiphers");
|
||||
@ -1661,6 +2085,15 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Navigation("CollectionUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b =>
|
||||
{
|
||||
b.Navigation("GroupAccessPolicies");
|
||||
|
||||
b.Navigation("ServiceAccountAccessPolicies");
|
||||
|
||||
b.Navigation("UserAccessPolicies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Ciphers");
|
||||
|
@ -549,6 +549,15 @@
|
||||
"Microsoft.Extensions.DependencyModel": "6.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.SqlServer": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.12",
|
||||
"contentHash": "bdKnSz1w+WZz9QYWhs3wwGuMn4YssjdR+HOBpzChQ6C3+dblq4Pammm5fzugcPOhTgCiWftOT2jPOT5hEy4bYg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Data.SqlClient": "2.1.4",
|
||||
"Microsoft.EntityFrameworkCore.Relational": "6.0.12"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Caching.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.0",
|
||||
@ -2757,6 +2766,7 @@
|
||||
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[11.0.0, )",
|
||||
"Core": "[2022.12.0, )",
|
||||
"Microsoft.EntityFrameworkCore.Relational": "[6.0.12, )",
|
||||
"Microsoft.EntityFrameworkCore.SqlServer": "[6.0.12, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[6.0.12, )",
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": "[6.0.8, )",
|
||||
"Pomelo.EntityFrameworkCore.MySql": "[6.0.2, )",
|
||||
|
Reference in New Issue
Block a user