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:
2129
util/PostgresMigrations/Migrations/20230106153838_SecretsManager.Designer.cs
generated
Normal file
2129
util/PostgresMigrations/Migrations/20230106153838_SecretsManager.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,325 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations;
|
||||
|
||||
public partial class SecretsManager : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "UseSecretsManager",
|
||||
table: "Organization",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RequestIpAddress",
|
||||
table: "AuthRequest",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RequestDeviceIdentifier",
|
||||
table: "AuthRequest",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "AccessCode",
|
||||
table: "AuthRequest",
|
||||
type: "character varying(25)",
|
||||
maxLength: 25,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Project",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DeletedDate = table.Column<DateTime>(type: "timestamp with time zone", 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);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Secret",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Key = table.Column<string>(type: "text", nullable: true),
|
||||
Value = table.Column<string>(type: "text", nullable: true),
|
||||
Note = table.Column<string>(type: "text", nullable: true),
|
||||
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DeletedDate = table.Column<DateTime>(type: "timestamp with time zone", 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);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ServiceAccount",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
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_ServiceAccount", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ServiceAccount_Organization_OrganizationId",
|
||||
column: x => x.OrganizationId,
|
||||
principalTable: "Organization",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProjectSecret",
|
||||
columns: table => new
|
||||
{
|
||||
ProjectsId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
SecretsId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
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);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AccessPolicy",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
GroupId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
GrantedProjectId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
GrantedServiceAccountId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
ServiceAccountId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
OrganizationUserId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
Read = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Write = table.Column<bool>(type: "boolean", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Discriminator = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
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");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ApiKey",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ServiceAccountId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
|
||||
ClientSecret = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: true),
|
||||
Scope = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: true),
|
||||
EncryptedPayload = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: true),
|
||||
Key = table.Column<string>(type: "text", nullable: true),
|
||||
ExpireAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
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_ApiKey", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ApiKey_ServiceAccount_ServiceAccountId",
|
||||
column: x => x.ServiceAccountId,
|
||||
principalTable: "ServiceAccount",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
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");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RequestIpAddress",
|
||||
table: "AuthRequest",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RequestDeviceIdentifier",
|
||||
table: "AuthRequest",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "AccessCode",
|
||||
table: "AuthRequest",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(25)",
|
||||
oldMaxLength: 25,
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
@ -18,19 +18,94 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False")
|
||||
.HasAnnotation("ProductVersion", "6.0.4")
|
||||
.HasAnnotation("ProductVersion", "6.0.12")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AccessPolicy", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Read")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Write")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
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("uuid");
|
||||
|
||||
b.Property<string>("ClientSecret")
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("EncryptedPayload")
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("character varying(4000)");
|
||||
|
||||
b.Property<DateTime?>("ExpireAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Scope")
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("character varying(4000)");
|
||||
|
||||
b.Property<Guid?>("ServiceAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
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")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AccessCode")
|
||||
.HasColumnType("text");
|
||||
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("character varying(25)");
|
||||
|
||||
b.Property<bool?>("Approved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
@ -50,7 +125,8 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RequestDeviceIdentifier")
|
||||
.HasColumnType("text");
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<byte>("RequestDeviceType")
|
||||
.HasColumnType("smallint");
|
||||
@ -59,7 +135,8 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RequestIpAddress")
|
||||
.HasColumnType("text");
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<DateTime?>("ResponseDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
@ -190,7 +267,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("CollectionGroups", (string)null);
|
||||
b.ToTable("CollectionGroups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b =>
|
||||
@ -216,7 +293,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("CollectionUsers", (string)null);
|
||||
b.ToTable("CollectionUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b =>
|
||||
@ -648,6 +725,9 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<bool>("UseScim")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("UseSecretsManager")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("UseSso")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
@ -836,6 +916,38 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.ToTable("Policy", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DeletedDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
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")
|
||||
@ -958,6 +1070,44 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.ToTable("ProviderUser", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DeletedDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
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")
|
||||
@ -1015,6 +1165,32 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.ToTable("Send", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
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")
|
||||
@ -1288,6 +1464,134 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.ToTable("User", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProjectSecret", b =>
|
||||
{
|
||||
b.Property<Guid>("ProjectsId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("SecretsId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
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("uuid")
|
||||
.HasColumnName("GrantedProjectId");
|
||||
|
||||
b.Property<Guid?>("GroupId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("uuid")
|
||||
.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("uuid")
|
||||
.HasColumnName("GrantedServiceAccountId");
|
||||
|
||||
b.Property<Guid?>("GroupId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("uuid")
|
||||
.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("uuid")
|
||||
.HasColumnName("GrantedProjectId");
|
||||
|
||||
b.Property<Guid?>("ServiceAccountId")
|
||||
.HasColumnType("uuid")
|
||||
.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("uuid")
|
||||
.HasColumnName("GrantedProjectId");
|
||||
|
||||
b.Property<Guid?>("OrganizationUserId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("uuid")
|
||||
.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("uuid")
|
||||
.HasColumnName("GrantedServiceAccountId");
|
||||
|
||||
b.Property<Guid?>("OrganizationUserId")
|
||||
.ValueGeneratedOnUpdateSometimes()
|
||||
.HasColumnType("uuid")
|
||||
.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")
|
||||
@ -1530,6 +1834,17 @@ namespace Bit.PostgresMigrations.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")
|
||||
@ -1566,6 +1881,17 @@ namespace Bit.PostgresMigrations.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")
|
||||
@ -1581,6 +1907,17 @@ namespace Bit.PostgresMigrations.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")
|
||||
@ -1624,6 +1961,96 @@ namespace Bit.PostgresMigrations.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");
|
||||
@ -1669,6 +2096,15 @@ namespace Bit.PostgresMigrations.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");
|
||||
|
Reference in New Issue
Block a user