Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AC-85] Set Max Seats Autoscale and Current Seats via Public API #3389

Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
931884c
Add new public models and controllers
cyprain-okeke Oct 30, 2023
f2a2580
Resolve pr comments
cyprain-okeke Nov 8, 2023
6742330
Merge branch 'master' into ac-85/set-max-seats-autoscale-and-current-…
cyprain-okeke Nov 8, 2023
ce652ca
Fix the failing test
cyprain-okeke Nov 8, 2023
12951d9
Merge branch 'master' into ac-85/set-max-seats-autoscale-and-current-…
cyprain-okeke Nov 22, 2023
0328a81
Change the controller name
cyprain-okeke Nov 22, 2023
3943b38
merge from master
cyprain-okeke Nov 22, 2023
fbab0bd
Merge remote-tracking branch 'origin/ac-85/set-max-seats-autoscale-an…
cyprain-okeke Nov 22, 2023
cf15695
Merge remote-tracking branch 'origin/ac-85/set-max-seats-autoscale-an…
cyprain-okeke Nov 22, 2023
77d303f
Merge remote-tracking branch 'origin/ac-85/set-max-seats-autoscale-an…
cyprain-okeke Nov 22, 2023
2d9b6ce
merge from master
cyprain-okeke Dec 1, 2023
a66fe43
resolve pr comments
cyprain-okeke Dec 1, 2023
6c35313
add the IValidatableObject
cyprain-okeke Dec 3, 2023
88e2f8f
resolve pr comment
cyprain-okeke Dec 3, 2023
82c7065
resolve pr comments
cyprain-okeke Dec 3, 2023
1b0e9bb
resolve pr comments
cyprain-okeke Dec 4, 2023
fc2e125
resolve
cyprain-okeke Dec 6, 2023
8ded407
removing the whitespaces
cyprain-okeke Dec 6, 2023
2835e95
Merge branch 'master' into ac-85/set-max-seats-autoscale-and-current-…
cyprain-okeke Dec 6, 2023
d08ab7e
Merge branch 'master' into ac-85/set-max-seats-autoscale-and-current-…
cyprain-okeke Dec 11, 2023
f0b06e1
code refactoring
cyprain-okeke Dec 11, 2023
b5ce313
merge from master
cyprain-okeke Dec 11, 2023
f9364c3
Merge branch 'master' into ac-85/set-max-seats-autoscale-and-current-…
cyprain-okeke Dec 12, 2023
d738ba1
Merge branch 'main' into ac-85/set-max-seats-autoscale-and-current-se…
cyprain-okeke Dec 15, 2023
814e9fc
Merge branch 'main' into ac-85/set-max-seats-autoscale-and-current-se…
cyprain-okeke Dec 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removing the whitespaces
  • Loading branch information
cyprain-okeke committed Dec 6, 2023
commit 8ded4077556461925958f4106d839efd1f1f39f3
20 changes: 7 additions & 13 deletions src/Api/Billing/Public/Controllers/OrganizationController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Net;
using Bit.Api.Models.Public.Response;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Context;
using Bit.Core.OrganizationFeatures.OrganizationSubscriptions.Interface;
using Bit.Core.Repositories;
Expand Down Expand Up @@ -48,7 +47,13 @@ public async Task<IActionResult> PostSubscriptionAsync([FromBody] OrganizationSu

if (model.PasswordManager != null)
{
await UpdatePasswordManagerSubscriptionAsync(organization, model);
model.PasswordManager.ToPasswordManagerSubscriptionUpdate(organization);
await _organizationService.UpdateSubscription(organization.Id, (int)model.PasswordManager.Seats,
model.PasswordManager.MaxAutoScaleSeats);
if (model.PasswordManager.Storage.HasValue)
{
await _organizationService.AdjustStorageAsync(organization.Id, (short)model.PasswordManager.Storage);
}
}

if (model.SecretsManager != null)
Expand All @@ -59,15 +64,4 @@ public async Task<IActionResult> PostSubscriptionAsync([FromBody] OrganizationSu

return new OkResult();
}

private async Task UpdatePasswordManagerSubscriptionAsync(Organization organization, OrganizationSubscriptionUpdateRequestModel model)
{
model.PasswordManager.MaxAutoScaleSeats ??= organization.MaxAutoscaleSeats;
await _organizationService.UpdateSubscription(organization.Id, (int)model.PasswordManager.Seats,
model.PasswordManager.MaxAutoScaleSeats);
if (model.PasswordManager.Storage.HasValue)
{
await _organizationService.AdjustStorageAsync(organization.Id, (short)model.PasswordManager.Storage);
}
}
}
Loading