1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 17:12:49 -05:00

Remove the u2f lib (#1820)

This commit is contained in:
Oscar Hinton
2022-01-24 12:14:04 +01:00
committed by GitHub
parent 5268f2781e
commit ac8ca46f0f
44 changed files with 3489 additions and 1247 deletions

View File

@ -36,7 +36,6 @@ namespace Bit.Infrastructure.EntityFramework.Repositories
public DbSet<SsoUser> SsoUsers { get; set; }
public DbSet<TaxRate> TaxRates { get; set; }
public DbSet<Transaction> Transactions { get; set; }
public DbSet<U2f> U2fs { get; set; }
public DbSet<User> Users { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
@ -66,7 +65,6 @@ namespace Bit.Infrastructure.EntityFramework.Repositories
var eSsoUser = builder.Entity<SsoUser>();
var eTaxRate = builder.Entity<TaxRate>();
var eTransaction = builder.Entity<Transaction>();
var eU2f = builder.Entity<U2f>();
var eUser = builder.Entity<User>();
eCipher.Property(c => c.Id).ValueGeneratedNever();
@ -128,7 +126,6 @@ namespace Bit.Infrastructure.EntityFramework.Repositories
eSsoUser.ToTable(nameof(SsoUser));
eTaxRate.ToTable(nameof(TaxRate));
eTransaction.ToTable(nameof(Transaction));
eU2f.ToTable(nameof(U2f));
eUser.ToTable(nameof(User));
}
}

View File

@ -1,55 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Bit.Core.Repositories;
using Bit.Infrastructure.EntityFramework.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace Bit.Infrastructure.EntityFramework.Repositories
{
public class U2fRepository : Repository<Core.Entities.U2f, U2f, int>, IU2fRepository
{
public U2fRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.U2fs)
{ }
public async Task<ICollection<Core.Entities.U2f>> GetManyByUserIdAsync(Guid userId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.U2fs.Where(u => u.UserId == userId).ToListAsync();
return (ICollection<Core.Entities.U2f>)results;
}
}
public async Task DeleteManyByUserIdAsync(Guid userId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var u2fs = dbContext.U2fs.Where(u => u.UserId == userId);
dbContext.RemoveRange(u2fs);
await dbContext.SaveChangesAsync();
}
}
public override Task ReplaceAsync(Core.Entities.U2f obj)
{
throw new NotSupportedException();
}
public override Task UpsertAsync(Core.Entities.U2f obj)
{
throw new NotSupportedException();
}
public override Task DeleteAsync(Core.Entities.U2f obj)
{
throw new NotSupportedException();
}
}
}