mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
api get generating organization license
This commit is contained in:
@ -55,7 +55,6 @@ namespace Bit.Core.Models.Api
|
||||
Utilities.CoreHelpers.ReadableBytesSize(organization.Storage.Value) : null;
|
||||
StorageGb = organization.Storage.HasValue ? Math.Round(organization.Storage.Value / 1073741824D) : 0; // 1 GB
|
||||
MaxStorageGb = organization.MaxStorageGb;
|
||||
// License = ...
|
||||
Expiration = DateTime.UtcNow.AddYears(1);
|
||||
}
|
||||
|
||||
@ -76,7 +75,6 @@ namespace Bit.Core.Models.Api
|
||||
public BillingSubscription Subscription { get; set; }
|
||||
public BillingInvoice UpcomingInvoice { get; set; }
|
||||
public IEnumerable<BillingCharge> Charges { get; set; }
|
||||
public OrganizationLicense License { get; set; }
|
||||
public DateTime? Expiration { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Services;
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
@ -12,13 +13,15 @@ namespace Bit.Core.Models.Business
|
||||
public OrganizationLicense()
|
||||
{ }
|
||||
|
||||
public OrganizationLicense(Organization org, Guid installationId)
|
||||
public OrganizationLicense(Organization org, Guid installationId, ILicensingService licenseService)
|
||||
{
|
||||
LicenseKey = "";
|
||||
LicenseKey = org.LicenseKey;
|
||||
InstallationId = installationId;
|
||||
Id = org.Id;
|
||||
Name = org.Name;
|
||||
Enabled = org.Enabled;
|
||||
Plan = org.Plan;
|
||||
PlanType = org.PlanType;
|
||||
Seats = org.Seats;
|
||||
MaxCollections = org.MaxCollections;
|
||||
UseGroups = org.UseGroups;
|
||||
@ -27,6 +30,10 @@ namespace Bit.Core.Models.Business
|
||||
MaxStorageGb = org.MaxStorageGb;
|
||||
SelfHost = org.SelfHost;
|
||||
Version = 1;
|
||||
Issued = DateTime.UtcNow;
|
||||
Expires = Issued.AddYears(1);
|
||||
Trial = false;
|
||||
Signature = Convert.ToBase64String(licenseService.SignLicense(this));
|
||||
}
|
||||
|
||||
public string LicenseKey { get; set; }
|
||||
|
Reference in New Issue
Block a user