mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
SelectionReadOnly MERGE to CollectionGroup
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using Dapper;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
using Dapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@ -65,6 +67,30 @@ namespace Bit.Core.Utilities
|
||||
return table;
|
||||
}
|
||||
|
||||
public static DataTable ToArrayTVP(this IEnumerable<SelectionReadOnly> values)
|
||||
{
|
||||
var table = new DataTable();
|
||||
table.SetTypeName("[dbo].[SelectionReadOnlyArray]");
|
||||
|
||||
var idColumn = new DataColumn("Id", typeof(Guid));
|
||||
table.Columns.Add(idColumn);
|
||||
var readOnlyColumn = new DataColumn("ReadOnly", typeof(bool));
|
||||
table.Columns.Add(readOnlyColumn);
|
||||
|
||||
if(values != null)
|
||||
{
|
||||
foreach(var value in values)
|
||||
{
|
||||
var row = table.NewRow();
|
||||
row[idColumn] = value.Id;
|
||||
row[readOnlyColumn] = value.ReadOnly;
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
public static X509Certificate2 GetCertificate(string thumbprint)
|
||||
{
|
||||
// Clean possible garbage characters from thumbprint copy/paste
|
||||
|
Reference in New Issue
Block a user