From 071f882d5386127089b56c96e00bb41b6913360e Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Tue, 13 Sep 2022 17:29:38 +0300 Subject: [PATCH 1/5] Payments: customerId = email --- common/ASC.Core.Common/Billing/Tariff.cs | 4 ++-- common/ASC.Core.Common/Billing/TariffService.cs | 3 +-- common/ASC.Core.Common/EF/Model/Tenant/DbTariff.cs | 6 +++--- .../20220830141345_CoreDbContext_Upgrade1.Designer.cs | 2 +- .../CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs | 3 ++- .../mysql/CoreDbContext/CoreDbContextModelSnapshot.cs | 2 +- .../20220830141345_CoreDbContext_Upgrade1.Designer.cs | 4 ++-- .../CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs | 6 +++--- .../postgre/CoreDbContext/CoreDbContextModelSnapshot.cs | 4 ++-- web/ASC.Web.Api/Api/PaymentsController.cs | 3 ++- 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/common/ASC.Core.Common/Billing/Tariff.cs b/common/ASC.Core.Common/Billing/Tariff.cs index 23fa43296c..0ee4b04927 100644 --- a/common/ASC.Core.Common/Billing/Tariff.cs +++ b/common/ASC.Core.Common/Billing/Tariff.cs @@ -34,7 +34,7 @@ public class Tariff public DateTime DueDate { get; set; } public DateTime DelayDueDate { get; set; } public DateTime LicenseDate { get; set; } - public Guid CustomerId { get; set; } + public string CustomerId { get; set; } public List> Quotas { get; set; } public static Tariff CreateDefault(bool empty = false) @@ -48,7 +48,7 @@ public class Tariff DueDate = DateTime.MaxValue, DelayDueDate = DateTime.MaxValue, LicenseDate = DateTime.MaxValue, - CustomerId = Guid.Empty, + CustomerId = "", Quotas = quotas }; } diff --git a/common/ASC.Core.Common/Billing/TariffService.cs b/common/ASC.Core.Common/Billing/TariffService.cs index 180f74c4af..208ebb1607 100644 --- a/common/ASC.Core.Common/Billing/TariffService.cs +++ b/common/ASC.Core.Common/Billing/TariffService.cs @@ -174,8 +174,7 @@ public class TariffService : ITariffService if (!string.IsNullOrEmpty(email)) { - var customer = _userService.GetUser(tenantId, email); - asynctariff.CustomerId = customer != null && !customer.Removed ? customer.Id : Guid.Empty; + asynctariff.CustomerId = email; } if (SaveBillingInfo(tenantId, asynctariff)) diff --git a/common/ASC.Core.Common/EF/Model/Tenant/DbTariff.cs b/common/ASC.Core.Common/EF/Model/Tenant/DbTariff.cs index 474b7c2420..0a1d4ce2fa 100644 --- a/common/ASC.Core.Common/EF/Model/Tenant/DbTariff.cs +++ b/common/ASC.Core.Common/EF/Model/Tenant/DbTariff.cs @@ -31,7 +31,7 @@ public class DbTariff public int Id { get; set; } public int Tenant { get; set; } public DateTime Stamp { get; set; } - public Guid CustomerId { get; set; } + public string CustomerId { get; set; } public string Comment { get; set; } public DateTime CreateOn { get; set; } } @@ -73,7 +73,7 @@ public static class DbTariffExtension entity.Property(e => e.CustomerId) .HasColumnName("customer_id") - .HasColumnType("varchar(36)") + .HasColumnType("varchar(255)") .HasCharSet("utf8") .UseCollation("utf8_general_ci"); @@ -104,7 +104,7 @@ public static class DbTariffExtension entity.Property(e => e.CustomerId) .HasColumnName("customer_id") - .HasMaxLength(36) + .HasMaxLength(255) .HasDefaultValueSql("NULL"); entity.Property(e => e.Tenant).HasColumnName("tenant"); diff --git a/migrations/mysql/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.Designer.cs b/migrations/mysql/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.Designer.cs index 43af83fca7..fdd59ace27 100644 --- a/migrations/mysql/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.Designer.cs +++ b/migrations/mysql/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.Designer.cs @@ -163,7 +163,7 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb b.Property("CustomerId") .IsRequired() - .HasColumnType("varchar(36)") + .HasColumnType("varchar(255)") .HasColumnName("customer_id") .UseCollation("utf8_general_ci") .HasAnnotation("MySql:CharSet", "utf8"); diff --git a/migrations/mysql/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs b/migrations/mysql/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs index 56dc27d967..3fa1be10bd 100644 --- a/migrations/mysql/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs +++ b/migrations/mysql/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs @@ -63,7 +63,8 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb migrationBuilder.AddColumn( name: "customer_id", table: "tenants_tariff", - type: "varchar(36)", + type: "varchar(255)", + maxLength: 255, nullable: false, defaultValue: "", collation: "utf8_general_ci") diff --git a/migrations/mysql/CoreDbContext/CoreDbContextModelSnapshot.cs b/migrations/mysql/CoreDbContext/CoreDbContextModelSnapshot.cs index 26ca12917e..8010e6493f 100644 --- a/migrations/mysql/CoreDbContext/CoreDbContextModelSnapshot.cs +++ b/migrations/mysql/CoreDbContext/CoreDbContextModelSnapshot.cs @@ -152,7 +152,7 @@ namespace ASC.Migrations.MySql.Migrations b.Property("CustomerId") .IsRequired() - .HasColumnType("varchar(36)") + .HasColumnType("varchar(255)") .HasColumnName("customer_id") .UseCollation("utf8_general_ci") .HasAnnotation("MySql:CharSet", "utf8"); diff --git a/migrations/postgre/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.Designer.cs b/migrations/postgre/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.Designer.cs index 937c297cfe..f87654e8de 100644 --- a/migrations/postgre/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.Designer.cs +++ b/migrations/postgre/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.Designer.cs @@ -162,8 +162,8 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb b.Property("CustomerId") .ValueGeneratedOnAdd() - .HasMaxLength(36) - .HasColumnType("uuid") + .HasMaxLength(255) + .HasColumnType("character varying(255)") .HasColumnName("customer_id") .HasDefaultValueSql("NULL"); diff --git a/migrations/postgre/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs b/migrations/postgre/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs index 0ead601a07..1755b90b6f 100644 --- a/migrations/postgre/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs +++ b/migrations/postgre/CoreDbContext/20220830141345_CoreDbContext_Upgrade1.cs @@ -67,12 +67,12 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb table: "tenants_quota", newName: "product_id"); - migrationBuilder.AddColumn( + migrationBuilder.AddColumn( name: "customer_id", schema: "onlyoffice", table: "tenants_tariff", - type: "uuid", - maxLength: 36, + type: "character varying(255)", + maxLength: 255, nullable: false, defaultValueSql: "NULL"); diff --git a/migrations/postgre/CoreDbContext/CoreDbContextModelSnapshot.cs b/migrations/postgre/CoreDbContext/CoreDbContextModelSnapshot.cs index 7ac910f6b6..2a1973b94c 100644 --- a/migrations/postgre/CoreDbContext/CoreDbContextModelSnapshot.cs +++ b/migrations/postgre/CoreDbContext/CoreDbContextModelSnapshot.cs @@ -151,8 +151,8 @@ namespace ASC.Migrations.PostgreSql.Migrations b.Property("CustomerId") .ValueGeneratedOnAdd() - .HasMaxLength(36) - .HasColumnType("uuid") + .HasMaxLength(255) + .HasColumnType("character varying(255)") .HasColumnName("customer_id") .HasDefaultValueSql("NULL"); diff --git a/web/ASC.Web.Api/Api/PaymentsController.cs b/web/ASC.Web.Api/Api/PaymentsController.cs index 9c8d43639a..d6b420e348 100644 --- a/web/ASC.Web.Api/Api/PaymentsController.cs +++ b/web/ASC.Web.Api/Api/PaymentsController.cs @@ -108,8 +108,9 @@ public class PaymentController : ControllerBase public Uri GetPaymentAccount(string backUrl) { var payerId = _tariffService.GetTariff(Tenant.Id).CustomerId; + var payer = _userManager.GetUserByEmail(payerId); - if (_securityContext.CurrentAccount.ID != payerId && + if (_securityContext.CurrentAccount.ID != payer.Id && _securityContext.CurrentAccount.ID != Tenant.OwnerId) { return null; From af6fa993e68e71507fc96aefedbca6e643c2cb7e Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Tue, 13 Sep 2022 18:18:43 +0300 Subject: [PATCH 2/5] Payments: added quota feature type --- .../Quota/Features/MaxFileSizeFeature.cs | 2 +- .../Quota/Features/MaxTotalSizeFeature.cs | 2 +- .../Quota/TenantQuotaFeature.cs | 4 ++-- common/ASC.Core.Common/Tenants/TenantQuota.cs | 4 ++-- .../ApiModels/ResponseDto/QuotaDto.cs | 9 +++++---- web/ASC.Web.Api/Core/QuotaHelper.cs | 19 ++++++++++--------- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/common/ASC.Core.Common/Quota/Features/MaxFileSizeFeature.cs b/common/ASC.Core.Common/Quota/Features/MaxFileSizeFeature.cs index ae3e002df9..2e1bf778ab 100644 --- a/common/ASC.Core.Common/Quota/Features/MaxFileSizeFeature.cs +++ b/common/ASC.Core.Common/Quota/Features/MaxFileSizeFeature.cs @@ -26,7 +26,7 @@ namespace ASC.Core.Common.Quota.Features; -internal class MaxFileSizeFeature : TenantQuotaFeatureLength +internal class MaxFileSizeFeature : TenantQuotaFeatureSize { public override string Name { get => "file_size"; } public MaxFileSizeFeature(TenantQuota tenantQuota) : base(tenantQuota) diff --git a/common/ASC.Core.Common/Quota/Features/MaxTotalSizeFeature.cs b/common/ASC.Core.Common/Quota/Features/MaxTotalSizeFeature.cs index 3593912d53..f61066d259 100644 --- a/common/ASC.Core.Common/Quota/Features/MaxTotalSizeFeature.cs +++ b/common/ASC.Core.Common/Quota/Features/MaxTotalSizeFeature.cs @@ -26,7 +26,7 @@ namespace ASC.Core.Common.Quota.Features; -public class MaxTotalSizeFeature : TenantQuotaFeatureLength +public class MaxTotalSizeFeature : TenantQuotaFeatureSize { public override string Name { get => "total_size"; } public override bool Paid { get => true; } diff --git a/common/ASC.Core.Common/Quota/TenantQuotaFeature.cs b/common/ASC.Core.Common/Quota/TenantQuotaFeature.cs index 2c868ac744..8c8e088f22 100644 --- a/common/ASC.Core.Common/Quota/TenantQuotaFeature.cs +++ b/common/ASC.Core.Common/Quota/TenantQuotaFeature.cs @@ -103,11 +103,11 @@ public class TenantQuotaFeatureCount : TenantQuotaFeature } } -public class TenantQuotaFeatureLength : TenantQuotaFeature +public class TenantQuotaFeatureSize : TenantQuotaFeature { protected override long Default => long.MaxValue; - public TenantQuotaFeatureLength(TenantQuota tenantQuota) : base(tenantQuota) + public TenantQuotaFeatureSize(TenantQuota tenantQuota) : base(tenantQuota) { } diff --git a/common/ASC.Core.Common/Tenants/TenantQuota.cs b/common/ASC.Core.Common/Tenants/TenantQuota.cs index f86d397c5b..cfad507bf3 100644 --- a/common/ASC.Core.Common/Tenants/TenantQuota.cs +++ b/common/ASC.Core.Common/Tenants/TenantQuota.cs @@ -328,11 +328,11 @@ public class TenantQuota : IMapFrom { fileSize.Value = Math.Max(fileSize.Value, quota.MaxFileSize); } - else if (f is TenantQuotaFeature count) + else if (f is TenantQuotaFeatureCount count) { count.Value += quota.GetFeature(f.Name).Value; } - else if (f is TenantQuotaFeatureLength length) + else if (f is TenantQuotaFeatureSize length) { length.Value += quota.GetFeature(f.Name).Value; } diff --git a/web/ASC.Web.Api/ApiModels/ResponseDto/QuotaDto.cs b/web/ASC.Web.Api/ApiModels/ResponseDto/QuotaDto.cs index c935752c00..79101c37ef 100644 --- a/web/ASC.Web.Api/ApiModels/ResponseDto/QuotaDto.cs +++ b/web/ASC.Web.Api/ApiModels/ResponseDto/QuotaDto.cs @@ -37,19 +37,20 @@ public class QuotaDto public bool Free { get; set; } public bool Trial { get; set; } - public IAsyncEnumerable Features { get; set; } + public IAsyncEnumerable Features { get; set; } } -public class QuotaFeatureDto : IEquatable +public class TenantQuotaFeatureDto : IEquatable { public string Id { get; set; } public string Title { get; set; } public string Image { get; set; } public object Value { get; set; } + public string Type { get; set; } public FeatureUsedDto Used { get; set; } public FeaturePriceDto Price { get; set; } - public bool Equals(QuotaFeatureDto other) + public bool Equals(TenantQuotaFeatureDto other) { if (other is null) { @@ -59,7 +60,7 @@ public class QuotaFeatureDto : IEquatable return Id == other.Id; } - public override bool Equals(object obj) => Equals(obj as QuotaFeatureDto); + public override bool Equals(object obj) => Equals(obj as TenantQuotaFeatureDto); public override int GetHashCode() => Id.GetHashCode(); } diff --git a/web/ASC.Web.Api/Core/QuotaHelper.cs b/web/ASC.Web.Api/Core/QuotaHelper.cs index bd666432d5..3a29e34dad 100644 --- a/web/ASC.Web.Api/Core/QuotaHelper.cs +++ b/web/ASC.Web.Api/Core/QuotaHelper.cs @@ -106,7 +106,7 @@ public class QuotaHelper return string.Format("{0}{1}", currentRegion.CurrencySymbol, priceString); } - private async IAsyncEnumerable GetFeatures(TenantQuota quota, string price, bool getUsed) + private async IAsyncEnumerable GetFeatures(TenantQuota quota, string price, bool getUsed) { var assembly = GetType().Assembly; @@ -114,7 +114,7 @@ public class QuotaHelper foreach (var feature in quota.TenantQuotaFeatures.Where(r => r.Visible).OrderBy(r => r.Order)) { - var result = new QuotaFeatureDto(); + var result = new TenantQuotaFeatureDto(); if (feature.Paid) { @@ -129,23 +129,24 @@ public class QuotaHelper object used = null; - if (feature is TenantQuotaFeature length) + if (feature is TenantQuotaFeatureSize size) { - var maxValue = length.Value == long.MaxValue; - result.Value = maxValue ? -1 : length.Value; + result.Value = size.Value == long.MaxValue ? -1 : size.Value; + result.Type = "size"; await GetStat(); } - else if (feature is TenantQuotaFeature count) + else if (feature is TenantQuotaFeatureCount count) { - var maxValue = count.Value == int.MaxValue; - result.Value = maxValue ? -1 : count.Value; + result.Value = count.Value == int.MaxValue ? -1 : count.Value; + result.Type = "count"; await GetStat(); } - else if (feature is TenantQuotaFeature flag) + else if (feature is TenantQuotaFeatureFlag flag) { result.Value = flag.Value; + result.Type = "flag"; } if (getUsed) From 6e51001e34c16d5dffc29674748449d8ecc745d2 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Tue, 13 Sep 2022 19:27:11 +0300 Subject: [PATCH 3/5] Api: payment settings. --- web/ASC.Web.Api/Api/Settings/SettingsController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/ASC.Web.Api/Api/Settings/SettingsController.cs b/web/ASC.Web.Api/Api/Settings/SettingsController.cs index 08cc06e1e7..fe1c8605cb 100644 --- a/web/ASC.Web.Api/Api/Settings/SettingsController.cs +++ b/web/ASC.Web.Api/Api/Settings/SettingsController.cs @@ -724,7 +724,12 @@ public class SettingsController : BaseSettingsController { var settings = _settingsManager.LoadForDefaultTenant(); var currentQuota = _tenantExtra.GetTenantQuota(); - var currentTariff = _tenantExtra.GetCurrentTariff(); + var currentTariff = _tenantExtra.GetCurrentTariff(); + + if (!int.TryParse(_configuration["core:payment:max-quantity"], out var maxQuotaQuantity)) + { + maxQuotaQuantity = 999; + } return new @@ -737,7 +742,8 @@ public class SettingsController : BaseSettingsController { currentQuota.Trial, currentTariff.DueDate.Date - } + }, + max = maxQuotaQuantity }; } From 7a17f325b13ec8a751faae60a92c9edaf3d085e4 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Tue, 13 Sep 2022 19:59:57 +0300 Subject: [PATCH 4/5] Api: payments. Removed FeaturePriceDto --- .../ApiModels/ResponseDto/QuotaDto.cs | 8 +------ web/ASC.Web.Api/Core/QuotaHelper.cs | 21 +++---------------- .../PublicResources/Resource.Designer.cs | 18 ---------------- .../PublicResources/Resource.resx | 6 ------ 4 files changed, 4 insertions(+), 49 deletions(-) diff --git a/web/ASC.Web.Api/ApiModels/ResponseDto/QuotaDto.cs b/web/ASC.Web.Api/ApiModels/ResponseDto/QuotaDto.cs index 79101c37ef..b70c6a08da 100644 --- a/web/ASC.Web.Api/ApiModels/ResponseDto/QuotaDto.cs +++ b/web/ASC.Web.Api/ApiModels/ResponseDto/QuotaDto.cs @@ -48,7 +48,7 @@ public class TenantQuotaFeatureDto : IEquatable public object Value { get; set; } public string Type { get; set; } public FeatureUsedDto Used { get; set; } - public FeaturePriceDto Price { get; set; } + public string PriceTitle { get; set; } public bool Equals(TenantQuotaFeatureDto other) { @@ -70,12 +70,6 @@ public class PriceDto public string CurrencySymbol { get; set; } } -public class FeaturePriceDto -{ - public string Count { get; set; } - public string Per { get; set; } -} - public class FeatureUsedDto { public object Value { get; set; } diff --git a/web/ASC.Web.Api/Core/QuotaHelper.cs b/web/ASC.Web.Api/Core/QuotaHelper.cs index 3a29e34dad..ad0ee41e0e 100644 --- a/web/ASC.Web.Api/Core/QuotaHelper.cs +++ b/web/ASC.Web.Api/Core/QuotaHelper.cs @@ -61,7 +61,7 @@ public class QuotaHelper private QuotaDto ToQuotaDto(TenantQuota quota, IDictionary> priceInfo, RegionInfo currentRegion, bool getUsed = false) { var price = GetPrice(quota, priceInfo, currentRegion); - var features = GetFeatures(quota, GetPriceString(price, currentRegion), getUsed); + var features = GetFeatures(quota, getUsed); return new QuotaDto { @@ -95,18 +95,7 @@ public class QuotaHelper return quota.Price; } - private string GetPriceString(decimal price, RegionInfo currentRegion) - { - var inEuro = "EUR".Equals(currentRegion.ISOCurrencySymbol); - - var priceString = inEuro && Math.Truncate(price) != price ? - price.ToString(CultureInfo.InvariantCulture) : - ((int)price).ToString(CultureInfo.InvariantCulture); - - return string.Format("{0}{1}", currentRegion.CurrencySymbol, priceString); - } - - private async IAsyncEnumerable GetFeatures(TenantQuota quota, string price, bool getUsed) + private async IAsyncEnumerable GetFeatures(TenantQuota quota, bool getUsed) { var assembly = GetType().Assembly; @@ -118,11 +107,7 @@ public class QuotaHelper if (feature.Paid) { - result.Price = new FeaturePriceDto - { - Per = string.Format(Resource.ResourceManager.GetString($"TariffsFeature_{feature.Name}_price_per"), price), - Count = Resource.ResourceManager.GetString($"TariffsFeature_{feature.Name}_price_count") - }; + result.PriceTitle = Resource.ResourceManager.GetString($"TariffsFeature_{feature.Name}_price_count"); } result.Id = feature.Name; diff --git a/web/ASC.Web.Core/PublicResources/Resource.Designer.cs b/web/ASC.Web.Core/PublicResources/Resource.Designer.cs index 5d8cf97c43..cee8c2ecf1 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.Designer.cs +++ b/web/ASC.Web.Core/PublicResources/Resource.Designer.cs @@ -2184,15 +2184,6 @@ namespace ASC.Web.Core.PublicResources { } } - /// - /// Looks up a localized string similar to {0} per manager/month. - /// - public static string TariffsFeature_manager_price_per { - get { - return ResourceManager.GetString("TariffsFeature_manager_price_per", resourceCulture); - } - } - /// /// Looks up a localized string similar to Automatic backup & recovery. /// @@ -2238,15 +2229,6 @@ namespace ASC.Web.Core.PublicResources { } } - /// - /// Looks up a localized string similar to . - /// - public static string TariffsFeature_total_size_price_per { - get { - return ResourceManager.GetString("TariffsFeature_total_size_price_per", resourceCulture); - } - } - /// /// Looks up a localized string similar to Storage space used:. /// diff --git a/web/ASC.Web.Core/PublicResources/Resource.resx b/web/ASC.Web.Core/PublicResources/Resource.resx index cbeda15c0f..d1c177852b 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.resx @@ -828,9 +828,6 @@ Number of managers - - {0} per manager/month - Tracking user logins & action @@ -867,9 +864,6 @@ Storage space - - - Max file size From 90c3cd29ba76f1b9c804f94ae6f2e31319babf86 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Tue, 13 Sep 2022 22:35:54 +0300 Subject: [PATCH 5/5] fix --- ...AdminFeature.cs => CountManagerFeature.cs} | 0 .../Quota/Features/UsersInRoomFeature.cs | 35 +++++++++++++++++++ common/ASC.Core.Common/Tenants/TenantQuota.cs | 9 +++++ .../PublicResources/Resource.Designer.cs | 33 +++++++++++++++-- .../PublicResources/Resource.resx | 11 +++++- 5 files changed, 84 insertions(+), 4 deletions(-) rename common/ASC.Core.Common/Quota/Features/{CountAdminFeature.cs => CountManagerFeature.cs} (100%) create mode 100644 common/ASC.Core.Common/Quota/Features/UsersInRoomFeature.cs diff --git a/common/ASC.Core.Common/Quota/Features/CountAdminFeature.cs b/common/ASC.Core.Common/Quota/Features/CountManagerFeature.cs similarity index 100% rename from common/ASC.Core.Common/Quota/Features/CountAdminFeature.cs rename to common/ASC.Core.Common/Quota/Features/CountManagerFeature.cs diff --git a/common/ASC.Core.Common/Quota/Features/UsersInRoomFeature.cs b/common/ASC.Core.Common/Quota/Features/UsersInRoomFeature.cs new file mode 100644 index 0000000000..13b6086977 --- /dev/null +++ b/common/ASC.Core.Common/Quota/Features/UsersInRoomFeature.cs @@ -0,0 +1,35 @@ +// (c) Copyright Ascensio System SIA 2010-2022 +// +// This program is a free software product. +// You can redistribute it and/or modify it under the terms +// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software +// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended +// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of +// any third-party rights. +// +// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// +// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. +// +// The interactive user interfaces in modified source and object code versions of the Program must +// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. +// +// Pursuant to Section 7(b) of the License you must retain the original Product logo when +// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under +// trademark law for use of our trademarks. +// +// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing +// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 +// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + +namespace ASC.Core.Common.Quota.Features; + +public class UsersInRoomFeature : TenantQuotaFeatureCount +{ + public override string Name { get => "usersInRoom"; } + public UsersInRoomFeature(TenantQuota tenantQuota) : base(tenantQuota) + { + } +} \ No newline at end of file diff --git a/common/ASC.Core.Common/Tenants/TenantQuota.cs b/common/ASC.Core.Common/Tenants/TenantQuota.cs index cfad507bf3..82c6bcaf99 100644 --- a/common/ASC.Core.Common/Tenants/TenantQuota.cs +++ b/common/ASC.Core.Common/Tenants/TenantQuota.cs @@ -97,6 +97,13 @@ public class TenantQuota : IMapFrom set => _countManagerFeature.Value = value; } + private readonly UsersInRoomFeature _usersInRoomFeature; + public int UsersInRoom + { + get => _usersInRoomFeature.Value; + set => _usersInRoomFeature.Value = value; + } + private readonly CountRoomFeature _countRoomFeature; public int CountRoom { @@ -215,6 +222,7 @@ public class TenantQuota : IMapFrom _activeUsersFeature = new ActiveUsersFeature(this) { Order = 1 }; _countManagerFeature = new CountManagerFeature(this); + _usersInRoomFeature = new UsersInRoomFeature(this) { Order = 8 }; _countRoomFeature = new CountRoomFeature(this) { Order = 2 }; _maxTotalSizeFeature = new MaxTotalSizeFeature(this); _maxFileSizeFeature = new MaxFileSizeFeature(this); @@ -238,6 +246,7 @@ public class TenantQuota : IMapFrom { _activeUsersFeature, _countManagerFeature, + _usersInRoomFeature, _countRoomFeature, _maxTotalSizeFeature, _maxFileSizeFeature, diff --git a/web/ASC.Web.Core/PublicResources/Resource.Designer.cs b/web/ASC.Web.Core/PublicResources/Resource.Designer.cs index cee8c2ecf1..309cb65e92 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.Designer.cs +++ b/web/ASC.Web.Core/PublicResources/Resource.Designer.cs @@ -2229,6 +2229,24 @@ namespace ASC.Web.Core.PublicResources { } } + /// + /// Looks up a localized string similar to Managers added:. + /// + public static string TariffsFeature_used_manager { + get { + return ResourceManager.GetString("TariffsFeature_used_manager", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Room:. + /// + public static string TariffsFeature_used_room { + get { + return ResourceManager.GetString("TariffsFeature_used_room", resourceCulture); + } + } + /// /// Looks up a localized string similar to Storage space used:. /// @@ -2239,11 +2257,11 @@ namespace ASC.Web.Core.PublicResources { } /// - /// Looks up a localized string similar to Managers added:. + /// Looks up a localized string similar to Users in room:. /// - public static string TariffsFeature_used_users { + public static string TariffsFeature_used_usersInRoom { get { - return ResourceManager.GetString("TariffsFeature_used_users", resourceCulture); + return ResourceManager.GetString("TariffsFeature_used_usersInRoom", resourceCulture); } } @@ -2256,6 +2274,15 @@ namespace ASC.Web.Core.PublicResources { } } + /// + /// Looks up a localized string similar to Users in room. + /// + public static string TariffsFeature_usersInRoom { + get { + return ResourceManager.GetString("TariffsFeature_usersInRoom", resourceCulture); + } + } + /// /// Looks up a localized string similar to Branding & customization. /// diff --git a/web/ASC.Web.Core/PublicResources/Resource.resx b/web/ASC.Web.Core/PublicResources/Resource.resx index d1c177852b..0e437fb512 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.resx @@ -855,7 +855,7 @@ Storage space used: - + Managers added: @@ -867,4 +867,13 @@ Max file size + + Room: + + + Users in room: + + + Users in room + \ No newline at end of file