1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-14 22:27:32 -05:00

[PM-15179] Implement endpoints to add existing organization to CB provider (#5310)

* Implement endpoints to add existing organization to provider

* Run dotnet format

* Support MOE

* Run dotnet format

* Move ProviderClientsController under AC ownership

* Move ProviderClientsControllerTests under AC ownership

* Jared's feedback
This commit is contained in:
Alex Morask
2025-02-04 09:02:18 -05:00
committed by GitHub
parent 90f308db34
commit f1b9bd9a09
14 changed files with 427 additions and 6 deletions

View File

@ -1,5 +1,6 @@
using System.Data;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.Auth.Entities;
using Bit.Core.Entities;
using Bit.Core.Models.Data.Organizations;
@ -180,4 +181,19 @@ public class OrganizationRepository : Repository<Organization, Guid>, IOrganizat
return result.ToList();
}
}
public async Task<ICollection<Organization>> GetAddableToProviderByUserIdAsync(
Guid userId,
ProviderType providerType)
{
using (var connection = new SqlConnection(ConnectionString))
{
var result = await connection.QueryAsync<Organization>(
$"[{Schema}].[{Table}_ReadAddableToProviderByUserId]",
new { UserId = userId, ProviderType = providerType },
commandType: CommandType.StoredProcedure);
return result.ToList();
}
}
}