1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-18 19:48:12 -05:00

Resolve Billing and Secrets Manager Code (#4645)

* Resolve Billing Warnings

* Resolve SM Warnings
This commit is contained in:
Justin Baur 2024-08-17 07:06:31 -04:00 committed by GitHub
parent abb223aabb
commit faa9afbe5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 6 deletions

View File

@ -16,7 +16,7 @@ public class ProjectRepository : Repository<Core.SecretsManager.Entities.Project
: base(serviceScopeFactory, mapper, db => db.Project) : base(serviceScopeFactory, mapper, db => db.Project)
{ } { }
public override async Task<Core.SecretsManager.Entities.Project> GetByIdAsync(Guid id) public override async Task<Core.SecretsManager.Entities.Project?> GetByIdAsync(Guid id)
{ {
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
{ {

View File

@ -19,7 +19,7 @@ public class SecretRepository : Repository<Core.SecretsManager.Entities.Secret,
: base(serviceScopeFactory, mapper, db => db.Secret) : base(serviceScopeFactory, mapper, db => db.Secret)
{ } { }
public override async Task<Core.SecretsManager.Entities.Secret> GetByIdAsync(Guid id) public override async Task<Core.SecretsManager.Entities.Secret?> GetByIdAsync(Guid id)
{ {
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
{ {

View File

@ -263,7 +263,7 @@ public class ServiceAccountRepository : Repository<Core.SecretsManager.Entities.
where ap.GrantedSecret.DeletedDate == null && where ap.GrantedSecret.DeletedDate == null &&
ap.GrantedSecretId != null ap.GrantedSecretId != null
select new ServiceAccountSecretsAccess(sa, select new ServiceAccountSecretsAccess(sa,
new List<Guid> { ap.GrantedSecretId.Value }); new List<Guid> { ap.GrantedSecretId!.Value });
private static List<ServiceAccountSecretsAccess> FilterDirectSecretAccessResults( private static List<ServiceAccountSecretsAccess> FilterDirectSecretAccessResults(
List<ServiceAccountSecretsAccess> projectSecretsAccessResults, List<ServiceAccountSecretsAccess> projectSecretsAccessResults,

View File

@ -19,17 +19,20 @@ public class OrganizationController : Controller
private readonly ICurrentContext _currentContext; private readonly ICurrentContext _currentContext;
private readonly IOrganizationRepository _organizationRepository; private readonly IOrganizationRepository _organizationRepository;
private readonly IUpdateSecretsManagerSubscriptionCommand _updateSecretsManagerSubscriptionCommand; private readonly IUpdateSecretsManagerSubscriptionCommand _updateSecretsManagerSubscriptionCommand;
private readonly ILogger<OrganizationController> _logger;
public OrganizationController( public OrganizationController(
IOrganizationService organizationService, IOrganizationService organizationService,
ICurrentContext currentContext, ICurrentContext currentContext,
IOrganizationRepository organizationRepository, IOrganizationRepository organizationRepository,
IUpdateSecretsManagerSubscriptionCommand updateSecretsManagerSubscriptionCommand) IUpdateSecretsManagerSubscriptionCommand updateSecretsManagerSubscriptionCommand,
ILogger<OrganizationController> logger)
{ {
_organizationService = organizationService; _organizationService = organizationService;
_currentContext = currentContext; _currentContext = currentContext;
_organizationRepository = organizationRepository; _organizationRepository = organizationRepository;
_updateSecretsManagerSubscriptionCommand = updateSecretsManagerSubscriptionCommand; _updateSecretsManagerSubscriptionCommand = updateSecretsManagerSubscriptionCommand;
_logger = logger;
} }
/// <summary> /// <summary>
@ -58,6 +61,7 @@ public class OrganizationController : Controller
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Unhandled error while updating the subscription");
return StatusCode(500, new { Message = "An error occurred while updating the subscription." }); return StatusCode(500, new { Message = "An error occurred while updating the subscription." });
} }
} }

View File

@ -17,7 +17,7 @@ public interface IProviderBillingService
/// <see cref="PlanType"/>. /// <see cref="PlanType"/>.
/// </summary> /// </summary>
/// <param name="provider">The <see cref="Provider"/> that manages the client <paramref name="organization"/>.</param> /// <param name="provider">The <see cref="Provider"/> that manages the client <paramref name="organization"/>.</param>
/// <param name="organization">The client <see cref="Organization"/> whose <see cref="seats"/> you want to update.</param> /// <param name="organization">The client <see cref="Organization"/> whose <paramref name="seats"/> you want to update.</param>
/// <param name="seats">The number of seats to assign to the client organization.</param> /// <param name="seats">The number of seats to assign to the client organization.</param>
Task AssignSeatsToClientOrganization( Task AssignSeatsToClientOrganization(
Provider provider, Provider provider,

View File

@ -90,7 +90,7 @@ public interface ISubscriberService
SubscriptionGetOptions subscriptionGetOptions = null); SubscriptionGetOptions subscriptionGetOptions = null);
/// <summary> /// <summary>
/// Retrieves the <see cref="subscriber"/>'s tax information using their Stripe <see cref="Stripe.Customer"/>'s <see cref="Stripe.Customer.Address"/>. /// Retrieves the <paramref name="subscriber"/>'s tax information using their Stripe <see cref="Stripe.Customer"/>'s <see cref="Stripe.Customer.Address"/>.
/// </summary> /// </summary>
/// <param name="subscriber">The subscriber to retrieve the tax information for.</param> /// <param name="subscriber">The subscriber to retrieve the tax information for.</param>
/// <returns>A <see cref="TaxInformation"/> representing the <paramref name="subscriber"/>'s tax information.</returns> /// <returns>A <see cref="TaxInformation"/> representing the <paramref name="subscriber"/>'s tax information.</returns>