mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 17:12:49 -05:00
[AC-1683] Fix DB migrations for new Manage permission (#3307)
* [AC-1683] Update migration script and introduce V2 procedures and types * [AC-1683] Update repository calls to use new V2 procedures / types * [AC-1684] Update bulk add collection migration script to use new V2 type * [AC-1683] Undo Manage changes to more original procedures * [AC-1683] Restore whitespace changes * [AC-1683] Clarify comments regarding explicit column lists * [AC-1683] Update migration script dates * [AC-1683] Split the migration script for readability * [AC-1683] Re-name SelectReadOnlyArray_V2 to CollectionAccessSelectionType
This commit is contained in:
@ -142,7 +142,7 @@ public class GroupRepository : Repository<Group, Guid>, IGroupRepository
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.ExecuteAsync(
|
||||
$"[{Schema}].[Group_CreateWithCollections]",
|
||||
$"[{Schema}].[Group_CreateWithCollections_V2]",
|
||||
objWithCollections,
|
||||
commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
@ -156,7 +156,7 @@ public class GroupRepository : Repository<Group, Guid>, IGroupRepository
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.ExecuteAsync(
|
||||
$"[{Schema}].[Group_UpdateWithCollections]",
|
||||
$"[{Schema}].[Group_UpdateWithCollections_V2]",
|
||||
objWithCollections,
|
||||
commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public static class DapperHelpers
|
||||
public static DataTable ToArrayTVP(this IEnumerable<CollectionAccessSelection> values)
|
||||
{
|
||||
var table = new DataTable();
|
||||
table.SetTypeName("[dbo].[SelectionReadOnlyArray]");
|
||||
table.SetTypeName("[dbo].[CollectionAccessSelectionType]");
|
||||
|
||||
var idColumn = new DataColumn("Id", typeof(Guid));
|
||||
table.Columns.Add(idColumn);
|
||||
|
@ -221,7 +221,7 @@ public class CollectionRepository : Repository<Collection, Guid>, ICollectionRep
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.ExecuteAsync(
|
||||
$"[{Schema}].[Collection_CreateWithGroupsAndUsers]",
|
||||
$"[{Schema}].[Collection_CreateWithGroupsAndUsers_V2]",
|
||||
objWithGroupsAndUsers,
|
||||
commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
@ -237,7 +237,7 @@ public class CollectionRepository : Repository<Collection, Guid>, ICollectionRep
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.ExecuteAsync(
|
||||
$"[{Schema}].[Collection_UpdateWithGroupsAndUsers]",
|
||||
$"[{Schema}].[Collection_UpdateWithGroupsAndUsers_V2]",
|
||||
objWithGroupsAndUsers,
|
||||
commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
@ -294,7 +294,7 @@ public class CollectionRepository : Repository<Collection, Guid>, ICollectionRep
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.ExecuteAsync(
|
||||
$"[{Schema}].[CollectionUser_UpdateUsers]",
|
||||
$"[{Schema}].[CollectionUser_UpdateUsers_V2]",
|
||||
new { CollectionId = id, Users = users.ToArrayTVP() },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public class OrganizationUserRepository : Repository<OrganizationUser, Guid>, IO
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.ExecuteAsync(
|
||||
$"[{Schema}].[OrganizationUser_CreateWithCollections]",
|
||||
$"[{Schema}].[OrganizationUser_CreateWithCollections_V2]",
|
||||
objWithCollections,
|
||||
commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
@ -343,7 +343,7 @@ public class OrganizationUserRepository : Repository<OrganizationUser, Guid>, IO
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.ExecuteAsync(
|
||||
$"[{Schema}].[OrganizationUser_UpdateWithCollections]",
|
||||
$"[{Schema}].[OrganizationUser_UpdateWithCollections_V2]",
|
||||
objWithCollections,
|
||||
commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
|
Reference in New Issue
Block a user