1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 13:08:17 -05:00

Delete unused IProviderOrganizationContext

This commit is contained in:
Thomas Rittson 2025-04-02 12:18:05 +10:00
parent a8b510c6a9
commit 7aa1adfebc
No known key found for this signature in database
GPG Key ID: CDDDA03861C35E27
4 changed files with 0 additions and 36 deletions

View File

@ -1,12 +0,0 @@
namespace Bit.Api.AdminConsole.Context;
/// <summary>
/// Current context for the relationship between ProviderUsers and Organizations that they manage.
/// </summary>
public interface IProviderOrganizationContext
{
/// <summary>
/// Returns true if the current user is a ProviderUser for the specified organization, false otherwise.
/// </summary>
Task<bool> ProviderUserForOrgAsync(Guid orgId);
}

View File

@ -1,21 +0,0 @@
using Bit.Core.Context;
namespace Bit.Api.AdminConsole.Context;
public class ProviderOrganizationContext(ICurrentContext currentContext) : IProviderOrganizationContext
{
/// <inheritdoc/>
public async Task<bool> ProviderUserForOrgAsync(Guid orgId)
{
// If the user doesn't have any ProviderUser claims (in relation to the provider), they can't have a provider
// relationship to any organization.
if (currentContext.Providers.Count == 0)
{
return false;
}
// This is just a wrapper around CurrentContext for now, but once permission checks are moved out of that class
// we should be able to move the underlying logic here without causing circular dependencies.
return await currentContext.ProviderUserForOrgAsync(orgId);
}
}

View File

@ -7,7 +7,6 @@ using Stripe;
using Bit.Core.Utilities;
using Duende.IdentityModel;
using System.Globalization;
using Bit.Api.AdminConsole.Context;
using Bit.Api.AdminConsole.Models.Request.Organizations;
using Bit.Api.Auth.Models.Request;
using Bit.Api.KeyManagement.Validators;
@ -85,7 +84,6 @@ public class Startup
// Context
services.AddScoped<ICurrentContext, CurrentContext>();
services.AddScoped<IProviderOrganizationContext, ProviderOrganizationContext>();
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
// Caching

View File

@ -60,7 +60,6 @@ public interface ICurrentContext
Task<bool> EditSubscription(Guid orgId);
Task<bool> EditPaymentMethods(Guid orgId);
Task<bool> ViewBillingHistory(Guid orgId);
[Obsolete("Use IProviderOrganizationContext.ProviderUserForOrgAsync instead.")]
Task<bool> ProviderUserForOrgAsync(Guid orgId);
bool ProviderProviderAdmin(Guid providerId);
bool ProviderUser(Guid providerId);