1
0
mirror of https://github.com/bitwarden/server synced 2025-12-26 13:13:24 +00:00

Turn on file scoped namespaces (#2225)

This commit is contained in:
Justin Baur
2022-08-29 14:53:16 -04:00
committed by GitHub
parent 7c4521e0b4
commit 34fb4cca2a
1206 changed files with 73816 additions and 75022 deletions

View File

@@ -5,40 +5,39 @@ using Bit.Core.Repositories;
using Bit.Core.Settings;
using Dapper;
namespace Bit.Infrastructure.Dapper.Repositories
namespace Bit.Infrastructure.Dapper.Repositories;
public class SsoUserRepository : Repository<SsoUser, long>, ISsoUserRepository
{
public class SsoUserRepository : Repository<SsoUser, long>, ISsoUserRepository
public SsoUserRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
{ }
public SsoUserRepository(string connectionString, string readOnlyConnectionString)
: base(connectionString, readOnlyConnectionString)
{ }
public async Task DeleteAsync(Guid userId, Guid? organizationId)
{
public SsoUserRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
{ }
public SsoUserRepository(string connectionString, string readOnlyConnectionString)
: base(connectionString, readOnlyConnectionString)
{ }
public async Task DeleteAsync(Guid userId, Guid? organizationId)
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.ExecuteAsync(
$"[{Schema}].[SsoUser_Delete]",
new { UserId = userId, OrganizationId = organizationId },
commandType: CommandType.StoredProcedure);
}
var results = await connection.ExecuteAsync(
$"[{Schema}].[SsoUser_Delete]",
new { UserId = userId, OrganizationId = organizationId },
commandType: CommandType.StoredProcedure);
}
}
public async Task<SsoUser> GetByUserIdOrganizationIdAsync(Guid organizationId, Guid userId)
public async Task<SsoUser> GetByUserIdOrganizationIdAsync(Guid organizationId, Guid userId)
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<SsoUser>(
$"[{Schema}].[SsoUser_ReadByUserIdOrganizationId]",
new { UserId = userId, OrganizationId = organizationId },
commandType: CommandType.StoredProcedure);
var results = await connection.QueryAsync<SsoUser>(
$"[{Schema}].[SsoUser_ReadByUserIdOrganizationId]",
new { UserId = userId, OrganizationId = organizationId },
commandType: CommandType.StoredProcedure);
return results.SingleOrDefault();
}
return results.SingleOrDefault();
}
}
}