Browse Source
* Remove OrganizationUser.AccessAll from code * Add shadow property * Remove remaining reference * dotnet format * Fix tests * Bump migration datespull/4698/head
21 changed files with 8249 additions and 159 deletions
@ -1,36 +0,0 @@
@@ -1,36 +0,0 @@
|
||||
using System.Data; |
||||
using Bit.Core.Entities; |
||||
using Dapper; |
||||
|
||||
#nullable enable |
||||
|
||||
namespace Bit.Infrastructure.Dapper.AdminConsole.Helpers; |
||||
|
||||
public static class OrganizationUserHelpers |
||||
{ |
||||
public static DataTable ToTvp(this IEnumerable<OrganizationUser> orgUsers) |
||||
{ |
||||
var table = new DataTable(); |
||||
table.SetTypeName("[dbo].[OrganizationUserType2]"); |
||||
|
||||
var columnData = new List<(string name, Type type, Func<OrganizationUser, object?> getter)> |
||||
{ |
||||
(nameof(OrganizationUser.Id), typeof(Guid), ou => ou.Id), |
||||
(nameof(OrganizationUser.OrganizationId), typeof(Guid), ou => ou.OrganizationId), |
||||
(nameof(OrganizationUser.UserId), typeof(Guid), ou => ou.UserId), |
||||
(nameof(OrganizationUser.Email), typeof(string), ou => ou.Email), |
||||
(nameof(OrganizationUser.Key), typeof(string), ou => ou.Key), |
||||
(nameof(OrganizationUser.Status), typeof(byte), ou => ou.Status), |
||||
(nameof(OrganizationUser.Type), typeof(byte), ou => ou.Type), |
||||
(nameof(OrganizationUser.AccessAll), typeof(bool), ou => ou.AccessAll), |
||||
(nameof(OrganizationUser.ExternalId), typeof(string), ou => ou.ExternalId), |
||||
(nameof(OrganizationUser.CreationDate), typeof(DateTime), ou => ou.CreationDate), |
||||
(nameof(OrganizationUser.RevisionDate), typeof(DateTime), ou => ou.RevisionDate), |
||||
(nameof(OrganizationUser.Permissions), typeof(string), ou => ou.Permissions), |
||||
(nameof(OrganizationUser.ResetPasswordKey), typeof(string), ou => ou.ResetPasswordKey), |
||||
(nameof(OrganizationUser.AccessSecretsManager), typeof(bool), ou => ou.AccessSecretsManager), |
||||
}; |
||||
|
||||
return orgUsers.BuildTable(table, columnData); |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace Bit.MySqlMigrations.Migrations; |
||||
|
||||
/// <inheritdoc /> |
||||
public partial class OrganizationUserAccessAllDefaultValue : Migration |
||||
{ |
||||
/// <inheritdoc /> |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropIndex( |
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status", |
||||
table: "OrganizationUser"); |
||||
|
||||
migrationBuilder.AlterColumn<bool>( |
||||
name: "AccessAll", |
||||
table: "OrganizationUser", |
||||
type: "tinyint(1)", |
||||
nullable: false, |
||||
defaultValue: false, |
||||
oldClrType: typeof(bool), |
||||
oldType: "tinyint(1)"); |
||||
} |
||||
|
||||
/// <inheritdoc /> |
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AlterColumn<bool>( |
||||
name: "AccessAll", |
||||
table: "OrganizationUser", |
||||
type: "tinyint(1)", |
||||
nullable: false, |
||||
oldClrType: typeof(bool), |
||||
oldType: "tinyint(1)", |
||||
oldDefaultValue: false); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status", |
||||
table: "OrganizationUser", |
||||
columns: new[] { "UserId", "OrganizationId", "Status" }); |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace Bit.PostgresMigrations.Migrations; |
||||
|
||||
/// <inheritdoc /> |
||||
public partial class OrganizationUserAccessAllDefaultValue : Migration |
||||
{ |
||||
/// <inheritdoc /> |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropIndex( |
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status", |
||||
table: "OrganizationUser"); |
||||
|
||||
migrationBuilder.AlterColumn<bool>( |
||||
name: "AccessAll", |
||||
table: "OrganizationUser", |
||||
type: "boolean", |
||||
nullable: false, |
||||
defaultValue: false, |
||||
oldClrType: typeof(bool), |
||||
oldType: "boolean"); |
||||
} |
||||
|
||||
/// <inheritdoc /> |
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AlterColumn<bool>( |
||||
name: "AccessAll", |
||||
table: "OrganizationUser", |
||||
type: "boolean", |
||||
nullable: false, |
||||
oldClrType: typeof(bool), |
||||
oldType: "boolean", |
||||
oldDefaultValue: false); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status", |
||||
table: "OrganizationUser", |
||||
columns: new[] { "UserId", "OrganizationId", "Status" }) |
||||
.Annotation("Npgsql:IndexInclude", new[] { "AccessAll" }); |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace Bit.SqliteMigrations.Migrations; |
||||
|
||||
/// <inheritdoc /> |
||||
public partial class OrganizationUserAccessAllDefaultValue : Migration |
||||
{ |
||||
/// <inheritdoc /> |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropIndex( |
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status", |
||||
table: "OrganizationUser"); |
||||
|
||||
migrationBuilder.AlterColumn<bool>( |
||||
name: "AccessAll", |
||||
table: "OrganizationUser", |
||||
type: "INTEGER", |
||||
nullable: false, |
||||
defaultValue: false, |
||||
oldClrType: typeof(bool), |
||||
oldType: "INTEGER"); |
||||
} |
||||
|
||||
/// <inheritdoc /> |
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AlterColumn<bool>( |
||||
name: "AccessAll", |
||||
table: "OrganizationUser", |
||||
type: "INTEGER", |
||||
nullable: false, |
||||
oldClrType: typeof(bool), |
||||
oldType: "INTEGER", |
||||
oldDefaultValue: false); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status", |
||||
table: "OrganizationUser", |
||||
columns: new[] { "UserId", "OrganizationId", "Status" }); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue