Quota: admin replaced with manager
This commit is contained in:
parent
83f4545f02
commit
bf5ce9cdb0
@ -62,7 +62,7 @@ public static class DbQuotaExtension
|
||||
Name = "trial",
|
||||
Description = null,
|
||||
MaxFileSize = 100,
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
Price = decimal.Parse("0,00"),
|
||||
ProductId = null,
|
||||
Visible = false
|
||||
@ -73,7 +73,7 @@ public static class DbQuotaExtension
|
||||
Name = "admin",
|
||||
Description = null,
|
||||
MaxFileSize = 1024,
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
Price = decimal.Parse("30,00"),
|
||||
ProductId = "1002",
|
||||
Visible = true
|
||||
@ -84,7 +84,7 @@ public static class DbQuotaExtension
|
||||
Name = "startup",
|
||||
Description = null,
|
||||
MaxFileSize = 100,
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,admin:5,rooms:3",
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,manager:5,rooms:3",
|
||||
Price = decimal.Parse("0,00"),
|
||||
ProductId = null,
|
||||
Visible = false
|
||||
|
@ -29,11 +29,12 @@ namespace ASC.Core.Common.Quota.Features;
|
||||
public class CountManagerFeature : TenantQuotaFeatureCount
|
||||
{
|
||||
public override bool Paid { get => true; }
|
||||
public override string Name { get => "admin"; }
|
||||
public override string Name { get => "manager"; }
|
||||
public CountManagerFeature(TenantQuota tenantQuota) : base(tenantQuota)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class CountManagerChecker : ITenantQuotaFeatureChecker
|
||||
{
|
||||
private readonly ITenantQuotaFeatureStatisticCount<CountManagerFeature> _tenantQuotaFeatureStatistic;
|
||||
|
@ -78,7 +78,7 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb
|
||||
new
|
||||
{
|
||||
Tenant = -1,
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
MaxFileSize = 100L,
|
||||
Name = "trial",
|
||||
Price = 0.00m,
|
||||
@ -87,7 +87,7 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb
|
||||
new
|
||||
{
|
||||
Tenant = -2,
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
MaxFileSize = 1024L,
|
||||
Name = "admin",
|
||||
Price = 30.00m,
|
||||
@ -97,7 +97,7 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb
|
||||
new
|
||||
{
|
||||
Tenant = -3,
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,admin:5,rooms:3",
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,manager:5,rooms:3",
|
||||
MaxFileSize = 100L,
|
||||
Name = "startup",
|
||||
Price = 0.00m,
|
||||
|
@ -1,3 +1,29 @@
|
||||
// (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
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
@ -61,17 +87,17 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb
|
||||
keyColumn: "tenant",
|
||||
keyValue: -1,
|
||||
columns: new[] { "features", "max_file_size", "name", "product_id" },
|
||||
values: new object[] { "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1", 100L, "trial", null });
|
||||
values: new object[] { "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1", 100L, "trial", null });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "tenants_quota",
|
||||
columns: new[] { "tenant", "description", "features", "max_file_size", "name", "product_id" },
|
||||
values: new object[] { -3, null, "free,audit,ldap,sso,restore,total_size:2147483648,admin:5,rooms:3", 100L, "startup", null });
|
||||
values: new object[] { -3, null, "free,audit,ldap,sso,restore,total_size:2147483648,manager:5,rooms:3", 100L, "startup", null });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "tenants_quota",
|
||||
columns: new[] { "tenant", "description", "features", "max_file_size", "name", "price", "product_id", "visible" },
|
||||
values: new object[] { -2, null, "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1", 1024L, "admin", 30.00m, "1002", true });
|
||||
values: new object[] { -2, null, "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1", 1024L, "admin", 30.00m, "1002", true });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
|
@ -76,7 +76,7 @@ namespace ASC.Migrations.MySql.Migrations
|
||||
new
|
||||
{
|
||||
Tenant = -1,
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
MaxFileSize = 100L,
|
||||
Name = "trial",
|
||||
Price = 0.00m,
|
||||
@ -85,7 +85,7 @@ namespace ASC.Migrations.MySql.Migrations
|
||||
new
|
||||
{
|
||||
Tenant = -2,
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
MaxFileSize = 1024L,
|
||||
Name = "admin",
|
||||
Price = 30.00m,
|
||||
@ -95,7 +95,7 @@ namespace ASC.Migrations.MySql.Migrations
|
||||
new
|
||||
{
|
||||
Tenant = -3,
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,admin:5,rooms:3",
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,manager:5,rooms:3",
|
||||
MaxFileSize = 100L,
|
||||
Name = "startup",
|
||||
Price = 0.00m,
|
||||
|
@ -73,7 +73,7 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
|
||||
new
|
||||
{
|
||||
Tenant = -1,
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
MaxFileSize = 100L,
|
||||
Name = "trial",
|
||||
Price = 0.00m,
|
||||
@ -82,7 +82,7 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
|
||||
new
|
||||
{
|
||||
Tenant = -2,
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
MaxFileSize = 1024L,
|
||||
Name = "admin",
|
||||
Price = 30.00m,
|
||||
@ -92,7 +92,7 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
|
||||
new
|
||||
{
|
||||
Tenant = -3,
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,admin:5,rooms:3",
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,manager:5,rooms:3",
|
||||
MaxFileSize = 100L,
|
||||
Name = "startup",
|
||||
Price = 0.00m,
|
||||
|
@ -1,5 +1,31 @@
|
||||
using System;
|
||||
// (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
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
@ -67,19 +93,19 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
|
||||
keyColumn: "tenant",
|
||||
keyValue: -1,
|
||||
columns: new[] { "features", "max_file_size", "name", "product_id" },
|
||||
values: new object[] { "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1", 100L, "trial", null });
|
||||
values: new object[] { "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1", 100L, "trial", null });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "onlyoffice",
|
||||
table: "tenants_quota",
|
||||
columns: new[] { "tenant", "description", "features", "max_file_size", "name", "visible" },
|
||||
values: new object[] { -3, null, "free,audit,ldap,sso,restore,total_size:2147483648,admin:5,rooms:3", 100L, "startup", false });
|
||||
values: new object[] { -3, null, "free,audit,ldap,sso,restore,total_size:2147483648,manager:5,rooms:3", 100L, "startup", false });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "onlyoffice",
|
||||
table: "tenants_quota",
|
||||
columns: new[] { "tenant", "description", "features", "max_file_size", "name", "price", "product_id", "visible" },
|
||||
values: new object[] { -2, null, "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1", 1024L, "admin", 30.00m, "1002", true });
|
||||
values: new object[] { -2, null, "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1", 1024L, "admin", 30.00m, "1002", true });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
|
@ -71,7 +71,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
|
||||
new
|
||||
{
|
||||
Tenant = -1,
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
MaxFileSize = 100L,
|
||||
Name = "trial",
|
||||
Price = 0.00m,
|
||||
@ -80,7 +80,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
|
||||
new
|
||||
{
|
||||
Tenant = -2,
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,admin:1",
|
||||
Features = "audit,ldap,sso,whitelabel,restore,total_size:10995116277760,manager:1",
|
||||
MaxFileSize = 1024L,
|
||||
Name = "admin",
|
||||
Price = 30.00m,
|
||||
@ -90,7 +90,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
|
||||
new
|
||||
{
|
||||
Tenant = -3,
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,admin:5,rooms:3",
|
||||
Features = "free,audit,ldap,sso,restore,total_size:2147483648,manager:5,rooms:3",
|
||||
MaxFileSize = 100L,
|
||||
Name = "startup",
|
||||
Price = 0.00m,
|
||||
|
@ -83,7 +83,6 @@ public class FeatureUsedDto
|
||||
|
||||
public class FeaturePriceRangeDto
|
||||
{
|
||||
public object Value { get; set; }
|
||||
public object Min { get; set; }
|
||||
public object Step { get; set; }
|
||||
public object Max { get; set; }
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public class QuotaHelper
|
||||
private readonly RegionHelper _regionHelper;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private const int Max = 999;
|
||||
|
||||
public QuotaHelper(TenantManager tenantManager, RegionHelper regionHelper, IServiceProvider serviceProvider)
|
||||
{
|
||||
_tenantManager = tenantManager;
|
||||
@ -44,18 +45,17 @@ public class QuotaHelper
|
||||
|
||||
public IEnumerable<QuotaDto> GetQuotas()
|
||||
{
|
||||
var tenantQuota = _tenantManager.GetTenantQuota(_tenantManager.GetCurrentTenant().Id);
|
||||
var quotaList = _tenantManager.GetTenantQuotas(false);
|
||||
var priceInfo = _tenantManager.GetProductPriceInfo();
|
||||
var currentRegion = _regionHelper.GetCurrentRegionInfo();
|
||||
|
||||
return quotaList.Select(x => ToQuotaDto(x, tenantQuota, priceInfo, currentRegion)).ToList();
|
||||
return quotaList.Select(x => ToQuotaDto(x, priceInfo, currentRegion)).ToList();
|
||||
}
|
||||
|
||||
private QuotaDto ToQuotaDto(TenantQuota quota, TenantQuota tenantQuota, IDictionary<string, Dictionary<string, decimal>> priceInfo, RegionInfo currentRegion)
|
||||
private QuotaDto ToQuotaDto(TenantQuota quota, IDictionary<string, Dictionary<string, decimal>> priceInfo, RegionInfo currentRegion)
|
||||
{
|
||||
var price = GetPrice(quota, priceInfo, currentRegion);
|
||||
var features = GetFeatures(quota, tenantQuota, GetPriceString(price, currentRegion));
|
||||
var features = GetFeatures(quota, GetPriceString(price, currentRegion));
|
||||
|
||||
return new QuotaDto
|
||||
{
|
||||
@ -100,7 +100,7 @@ public class QuotaHelper
|
||||
return string.Format("{0}{1}", currentRegion.CurrencySymbol, priceString);
|
||||
}
|
||||
|
||||
private IEnumerable<QuotaFeatureDto> GetFeatures(TenantQuota quota, TenantQuota tenantQuota, string price)
|
||||
private IEnumerable<QuotaFeatureDto> GetFeatures(TenantQuota quota, string price)
|
||||
{
|
||||
var assembly = GetType().Assembly;
|
||||
|
||||
@ -152,9 +152,8 @@ public class QuotaHelper
|
||||
{
|
||||
result.Price.Range = new FeaturePriceRangeDto
|
||||
{
|
||||
Value = length.Value,
|
||||
Min = tenantQuota.GetFeature<long>(length.Name).Value, // must set to used quota
|
||||
Max = Max * length.Value,
|
||||
Step = length.Value,
|
||||
Max = Max * length.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -171,9 +170,8 @@ public class QuotaHelper
|
||||
{
|
||||
result.Price.Range = new FeaturePriceRangeDto
|
||||
{
|
||||
Value = count.Value,
|
||||
Min = tenantQuota.GetFeature<int>(count.Name).Value,
|
||||
Max = Max * count.Value,
|
||||
Step = count.Value,
|
||||
Max = Max * count.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -2157,30 +2157,30 @@ namespace ASC.Web.Core.PublicResources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tracking user logins & action.
|
||||
/// </summary>
|
||||
public static string TariffsFeature_audit {
|
||||
get {
|
||||
return ResourceManager.GetString("TariffsFeature_audit", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Number of managers.
|
||||
/// </summary>
|
||||
public static string TariffsFeature_admin_price_count {
|
||||
public static string TariffsFeature_manager_price_count {
|
||||
get {
|
||||
return ResourceManager.GetString("TariffsFeature_admin_price_count", resourceCulture);
|
||||
return ResourceManager.GetString("TariffsFeature_manager_price_count", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} per manager/month.
|
||||
/// </summary>
|
||||
public static string TariffsFeature_admin_price_per {
|
||||
public static string TariffsFeature_manager_price_per {
|
||||
get {
|
||||
return ResourceManager.GetString("TariffsFeature_admin_price_per", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tracking user logins & action.
|
||||
/// </summary>
|
||||
public static string TariffsFeature_audit {
|
||||
get {
|
||||
return ResourceManager.GetString("TariffsFeature_audit", resourceCulture);
|
||||
return ResourceManager.GetString("TariffsFeature_manager_price_per", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -825,10 +825,10 @@
|
||||
<data name="MessageRoomInvitationsSentOnEmail" xml:space="preserve">
|
||||
<value>Virtual room {0} invitations sent successfully.</value>
|
||||
</data>
|
||||
<data name="TariffsFeature_admin_price_count" xml:space="preserve">
|
||||
<data name="TariffsFeature_manager_price_count" xml:space="preserve">
|
||||
<value>Number of managers</value>
|
||||
</data>
|
||||
<data name="TariffsFeature_admin_price_per" xml:space="preserve">
|
||||
<data name="TariffsFeature_manager_price_per" xml:space="preserve">
|
||||
<value>{0} per manager/month</value>
|
||||
</data>
|
||||
<data name="TariffsFeature_audit" xml:space="preserve">
|
||||
|
Loading…
Reference in New Issue
Block a user