mirror of
https://github.com/bitwarden/server
synced 2025-12-14 07:13:39 +00:00
[EC-635] Extract organizationService.UpdateLicenseAsync to a command (#2408)
* move UpdateLicenseAsync from service to command * create new SelfHostedOrganizationDetails view model and move license validation logic there * move occupied seat count logic to database level
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Entities;
|
||||
@@ -197,4 +198,33 @@ public class Organization : ITableObject<Guid>, ISubscriber, IStorable, IStorabl
|
||||
|
||||
return providers[provider];
|
||||
}
|
||||
|
||||
public void UpdateFromLicense(OrganizationLicense license)
|
||||
{
|
||||
Name = license.Name;
|
||||
BusinessName = license.BusinessName;
|
||||
BillingEmail = license.BillingEmail;
|
||||
PlanType = license.PlanType;
|
||||
Seats = license.Seats;
|
||||
MaxCollections = license.MaxCollections;
|
||||
UseGroups = license.UseGroups;
|
||||
UseDirectory = license.UseDirectory;
|
||||
UseEvents = license.UseEvents;
|
||||
UseTotp = license.UseTotp;
|
||||
Use2fa = license.Use2fa;
|
||||
UseApi = license.UseApi;
|
||||
UsePolicies = license.UsePolicies;
|
||||
UseSso = license.UseSso;
|
||||
UseKeyConnector = license.UseKeyConnector;
|
||||
UseScim = license.UseScim;
|
||||
UseResetPassword = license.UseResetPassword;
|
||||
SelfHost = license.SelfHost;
|
||||
UsersGetPremium = license.UsersGetPremium;
|
||||
UseCustomPermissions = license.UseCustomPermissions;
|
||||
Plan = license.Plan;
|
||||
Enabled = license.Enabled;
|
||||
ExpirationDate = license.Expires;
|
||||
LicenseKey = license.LicenseKey;
|
||||
RevisionDate = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user