Merge branch 'release/rc-v1.2.0' of https://github.com/ONLYOFFICE/DocSpace into release/rc-v1.2.0

This commit is contained in:
Viktor Fomin 2022-12-26 14:32:33 +03:00
commit f05643adb5
21 changed files with 413 additions and 312 deletions

View File

@ -59,7 +59,7 @@ public static class DbQuotaExtension
Tenant = -1,
Name = "trial",
Description = null,
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:100,manager:1",
Features = "trial,audit,ldap,sso,whitelabel,thirdparty,restore,total_size:107374182400,file_size:100,manager:1",
Price = 0,
ProductId = null,
Visible = false
@ -69,7 +69,7 @@ public static class DbQuotaExtension
Tenant = -2,
Name = "admin",
Description = null,
Features = "audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:1024,manager:1",
Features = "audit,ldap,sso,whitelabel,thirdparty,restore,total_size:107374182400,file_size:1024,manager:1",
Price = 30,
ProductId = "1002",
Visible = true
@ -79,7 +79,7 @@ public static class DbQuotaExtension
Tenant = -3,
Name = "startup",
Description = null,
Features = "free,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Features = "free,thirdparty,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Price = 0,
ProductId = null,
Visible = false

View File

@ -72,7 +72,7 @@ namespace ASC.Migrations.MySql.Migrations
new
{
Tenant = -1,
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:100,manager:1",
Features = "trial,audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:100,manager:1",
Name = "trial",
Price = 0m,
Visible = false
@ -80,7 +80,7 @@ namespace ASC.Migrations.MySql.Migrations
new
{
Tenant = -2,
Features = "audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:1024,manager:1",
Features = "audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:1024,manager:1",
Name = "admin",
Price = 30m,
ProductId = "1002",
@ -89,7 +89,7 @@ namespace ASC.Migrations.MySql.Migrations
new
{
Tenant = -3,
Features = "free,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Features = "free,thirdparty,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Name = "startup",
Price = 0m,
Visible = false

View File

@ -29,131 +29,130 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ASC.Migrations.MySql.Migrations
namespace ASC.Migrations.MySql.Migrations;
public partial class CoreDbContextMigrate : Migration
{
public partial class CoreDbContextMigrate : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "tenants_quota",
columns: table => new
{
tenant = table.Column<int>(type: "int", nullable: false),
name = table.Column<string>(type: "varchar(128)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
description = table.Column<string>(type: "varchar(128)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
features = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8"),
price = table.Column<decimal>(type: "decimal(10,2)", nullable: false, defaultValueSql: "'0.00'"),
product_id = table.Column<string>(type: "varchar(128)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
visible = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValueSql: "'0'")
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.tenant);
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "tenants_quota",
columns: table => new
{
tenant = table.Column<int>(type: "int", nullable: false),
name = table.Column<string>(type: "varchar(128)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
description = table.Column<string>(type: "varchar(128)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
features = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8"),
price = table.Column<decimal>(type: "decimal(10,2)", nullable: false, defaultValueSql: "'0.00'"),
product_id = table.Column<string>(type: "varchar(128)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
visible = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValueSql: "'0'")
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.tenant);
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "tenants_quotarow",
columns: table => new
{
tenant = table.Column<int>(type: "int", nullable: false),
path = table.Column<string>(type: "varchar(255)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
user_id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
counter = table.Column<long>(type: "bigint", nullable: false, defaultValueSql: "'0'"),
tag = table.Column<string>(type: "varchar(1024)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
last_modified = table.Column<DateTime>(type: "timestamp", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => new { x.tenant, x.user_id, x.path });
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "tenants_quotarow",
columns: table => new
{
tenant = table.Column<int>(type: "int", nullable: false),
path = table.Column<string>(type: "varchar(255)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
user_id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
counter = table.Column<long>(type: "bigint", nullable: false, defaultValueSql: "'0'"),
tag = table.Column<string>(type: "varchar(1024)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
last_modified = table.Column<DateTime>(type: "timestamp", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => new { x.tenant, x.user_id, x.path });
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "tenants_tariff",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
tenant = table.Column<int>(type: "int", nullable: false),
stamp = table.Column<DateTime>(type: "datetime", nullable: false),
customer_id = table.Column<string>(type: "varchar(255)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
comment = table.Column<string>(type: "varchar(255)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
create_on = table.Column<DateTime>(type: "timestamp", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_tenants_tariff", x => x.id);
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "tenants_tariff",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
tenant = table.Column<int>(type: "int", nullable: false),
stamp = table.Column<DateTime>(type: "datetime", nullable: false),
customer_id = table.Column<string>(type: "varchar(255)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
comment = table.Column<string>(type: "varchar(255)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
create_on = table.Column<DateTime>(type: "timestamp", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_tenants_tariff", x => x.id);
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "tenants_tariffrow",
columns: table => new
{
tariff_id = table.Column<int>(type: "int", nullable: false),
quota = table.Column<int>(type: "int", nullable: false),
tenant = table.Column<int>(type: "int", nullable: false),
quantity = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => new { x.tenant, x.tariff_id, x.quota });
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "tenants_tariffrow",
columns: table => new
{
tariff_id = table.Column<int>(type: "int", nullable: false),
quota = table.Column<int>(type: "int", nullable: false),
tenant = table.Column<int>(type: "int", nullable: false),
quantity = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => new { x.tenant, x.tariff_id, x.quota });
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "product_id" },
values: new object[] { -3, null, "free,total_size:2147483648,manager:1,room:12,usersInRoom:3", "startup", null });
migrationBuilder.InsertData(
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "product_id" },
values: new object[] { -3, null, "free,thirdparty,total_size:2147483648,manager:1,room:12,usersInRoom:3", "startup", null });
migrationBuilder.InsertData(
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "price", "product_id", "visible" },
values: new object[] { -2, null, "audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:1024,manager:1", "admin", 30m, "1002", true });
migrationBuilder.InsertData(
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "price", "product_id", "visible" },
values: new object[] { -2, null, "audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:1024,manager:1", "admin", 30m, "1002", true });
migrationBuilder.InsertData(
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "product_id" },
values: new object[] { -1, null, "trial,audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:100,manager:1", "trial", null });
migrationBuilder.InsertData(
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "product_id" },
values: new object[] { -1, null, "trial,audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:100,manager:1", "trial", null });
migrationBuilder.CreateIndex(
name: "last_modified",
table: "tenants_quotarow",
column: "last_modified");
migrationBuilder.CreateIndex(
name: "last_modified",
table: "tenants_quotarow",
column: "last_modified");
migrationBuilder.CreateIndex(
name: "tenant",
table: "tenants_tariff",
column: "tenant");
}
migrationBuilder.CreateIndex(
name: "tenant",
table: "tenants_tariff",
column: "tenant");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "tenants_quota");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "tenants_quota");
migrationBuilder.DropTable(
name: "tenants_quotarow");
migrationBuilder.DropTable(
name: "tenants_quotarow");
migrationBuilder.DropTable(
name: "tenants_tariff");
migrationBuilder.DropTable(
name: "tenants_tariff");
migrationBuilder.DropTable(
name: "tenants_tariffrow");
}
migrationBuilder.DropTable(
name: "tenants_tariffrow");
}
}

View File

@ -70,7 +70,7 @@ namespace ASC.Migrations.MySql.Migrations
new
{
Tenant = -1,
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:100,manager:1",
Features = "trial,audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:100,manager:1",
Name = "trial",
Price = 0m,
Visible = false
@ -78,7 +78,7 @@ namespace ASC.Migrations.MySql.Migrations
new
{
Tenant = -2,
Features = "audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:1024,manager:1",
Features = "audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:1024,manager:1",
Name = "admin",
Price = 30m,
ProductId = "1002",
@ -87,7 +87,7 @@ namespace ASC.Migrations.MySql.Migrations
new
{
Tenant = -3,
Features = "free,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Features = "free,thirdparty,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Name = "startup",
Price = 0m,
Visible = false

View File

@ -67,7 +67,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
new
{
Tenant = -1,
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:100,manager:1",
Features = "trial,audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:100,manager:1",
Name = "trial",
Price = 0m,
Visible = false
@ -75,7 +75,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
new
{
Tenant = -2,
Features = "audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:1024,manager:1",
Features = "audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:1024,manager:1",
Name = "admin",
Price = 30m,
ProductId = "1002",
@ -84,7 +84,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
new
{
Tenant = -3,
Features = "free,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Features = "free,thirdparty,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Name = "startup",
Price = 0m,
Visible = false

View File

@ -30,131 +30,130 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ASC.Migrations.PostgreSql.Migrations
namespace ASC.Migrations.PostgreSql.Migrations;
public partial class CoreDbContextMigrate : Migration
{
public partial class CoreDbContextMigrate : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "onlyoffice");
migrationBuilder.EnsureSchema(
name: "onlyoffice");
migrationBuilder.CreateTable(
name: "tenants_quota",
schema: "onlyoffice",
columns: table => new
{
tenant = table.Column<int>(type: "integer", nullable: false),
name = table.Column<string>(type: "character varying", nullable: true),
description = table.Column<string>(type: "character varying", nullable: true),
features = table.Column<string>(type: "text", nullable: true),
price = table.Column<decimal>(type: "numeric(10,2)", nullable: false, defaultValueSql: "0.00"),
product_id = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, defaultValueSql: "NULL"),
visible = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("tenants_quota_pkey", x => x.tenant);
});
migrationBuilder.CreateTable(
name: "tenants_quota",
schema: "onlyoffice",
columns: table => new
{
tenant = table.Column<int>(type: "integer", nullable: false),
name = table.Column<string>(type: "character varying", nullable: true),
description = table.Column<string>(type: "character varying", nullable: true),
features = table.Column<string>(type: "text", nullable: true),
price = table.Column<decimal>(type: "numeric(10,2)", nullable: false, defaultValueSql: "0.00"),
product_id = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, defaultValueSql: "NULL"),
visible = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("tenants_quota_pkey", x => x.tenant);
});
migrationBuilder.CreateTable(
name: "tenants_quotarow",
schema: "onlyoffice",
columns: table => new
{
tenant = table.Column<int>(type: "integer", nullable: false),
path = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
counter = table.Column<long>(type: "bigint", nullable: false, defaultValueSql: "'0'"),
tag = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true, defaultValueSql: "'0'"),
last_modified = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
user_id = table.Column<Guid>(type: "uuid", maxLength: 36, nullable: false, defaultValueSql: "NULL")
},
constraints: table =>
{
table.PrimaryKey("tenants_quotarow_pkey", x => new { x.tenant, x.path });
});
migrationBuilder.CreateTable(
name: "tenants_quotarow",
schema: "onlyoffice",
columns: table => new
{
tenant = table.Column<int>(type: "integer", nullable: false),
path = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
counter = table.Column<long>(type: "bigint", nullable: false, defaultValueSql: "'0'"),
tag = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true, defaultValueSql: "'0'"),
last_modified = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
user_id = table.Column<Guid>(type: "uuid", maxLength: 36, nullable: false, defaultValueSql: "NULL")
},
constraints: table =>
{
table.PrimaryKey("tenants_quotarow_pkey", x => new { x.tenant, x.path });
});
migrationBuilder.CreateTable(
name: "tenants_tariff",
schema: "onlyoffice",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
tenant = table.Column<int>(type: "integer", nullable: false),
stamp = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
customer_id = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, defaultValueSql: "NULL"),
comment = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, defaultValueSql: "NULL"),
create_on = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("PK_tenants_tariff", x => x.id);
});
migrationBuilder.CreateTable(
name: "tenants_tariff",
schema: "onlyoffice",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
tenant = table.Column<int>(type: "integer", nullable: false),
stamp = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
customer_id = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, defaultValueSql: "NULL"),
comment = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, defaultValueSql: "NULL"),
create_on = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("PK_tenants_tariff", x => x.id);
});
migrationBuilder.CreateTable(
name: "tenants_tariffrow",
schema: "onlyoffice",
columns: table => new
{
tariff_id = table.Column<int>(type: "int", nullable: false),
quota = table.Column<int>(type: "int", nullable: false),
tenant = table.Column<int>(type: "int", nullable: false),
quantity = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => new { x.tenant, x.tariff_id, x.quota });
});
migrationBuilder.CreateTable(
name: "tenants_tariffrow",
schema: "onlyoffice",
columns: table => new
{
tariff_id = table.Column<int>(type: "int", nullable: false),
quota = table.Column<int>(type: "int", nullable: false),
tenant = table.Column<int>(type: "int", nullable: false),
quantity = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => new { x.tenant, x.tariff_id, x.quota });
});
migrationBuilder.InsertData(
schema: "onlyoffice",
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "visible" },
values: new object[] { -3, null, "free,total_size:2147483648,manager:1,room:12,usersInRoom:3", "startup", false });
migrationBuilder.InsertData(
schema: "onlyoffice",
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "visible" },
values: new object[] { -3, null, "free,thirdparty,total_size:2147483648,manager:1,room:12,usersInRoom:3", "startup", false });
migrationBuilder.InsertData(
schema: "onlyoffice",
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "price", "product_id", "visible" },
values: new object[] { -2, null, "audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:1024,manager:1", "admin", 30m, "1002", true });
migrationBuilder.InsertData(
schema: "onlyoffice",
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "price", "product_id", "visible" },
values: new object[] { -2, null, "audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:1024,manager:1", "admin", 30m, "1002", true });
migrationBuilder.InsertData(
schema: "onlyoffice",
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "visible" },
values: new object[] { -1, null, "trial,audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:100,manager:1", "trial", false });
migrationBuilder.InsertData(
schema: "onlyoffice",
table: "tenants_quota",
columns: new[] { "tenant", "description", "features", "name", "visible" },
values: new object[] { -1, null, "trial,audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:100,manager:1", "trial", false });
migrationBuilder.CreateIndex(
name: "last_modified_tenants_quotarow",
schema: "onlyoffice",
table: "tenants_quotarow",
column: "last_modified");
migrationBuilder.CreateIndex(
name: "last_modified_tenants_quotarow",
schema: "onlyoffice",
table: "tenants_quotarow",
column: "last_modified");
migrationBuilder.CreateIndex(
name: "tenant_tenants_tariff",
schema: "onlyoffice",
table: "tenants_tariff",
column: "tenant");
}
migrationBuilder.CreateIndex(
name: "tenant_tenants_tariff",
schema: "onlyoffice",
table: "tenants_tariff",
column: "tenant");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "tenants_quota",
schema: "onlyoffice");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "tenants_quota",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "tenants_quotarow",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "tenants_quotarow",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "tenants_tariff",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "tenants_tariff",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "tenants_tariffrow",
schema: "onlyoffice");
}
migrationBuilder.DropTable(
name: "tenants_tariffrow",
schema: "onlyoffice");
}
}

View File

@ -65,7 +65,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
new
{
Tenant = -1,
Features = "trial,audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:100,manager:1",
Features = "trial,audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:100,manager:1",
Name = "trial",
Price = 0m,
Visible = false
@ -73,7 +73,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
new
{
Tenant = -2,
Features = "audit,ldap,sso,whitelabel,restore,total_size:107374182400,file_size:1024,manager:1",
Features = "audit,ldap,sso,whitelabel,restore,thirdparty,total_size:107374182400,file_size:1024,manager:1",
Name = "admin",
Price = 30m,
ProductId = "1002",
@ -82,7 +82,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
new
{
Tenant = -3,
Features = "free,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Features = "free,thirdparty,total_size:2147483648,manager:1,room:12,usersInRoom:3",
Name = "startup",
Price = 0m,
Visible = false

View File

@ -6,9 +6,10 @@ import SelectUsersCountContainer from "./sub-components/SelectUsersCountContaine
import TotalTariffContainer from "./sub-components/TotalTariffContainer";
import toastr from "@docspace/components/toast/toastr";
import axios from "axios";
import { combineUrl } from "@docspace/common/utils";
//import { combineUrl } from "@docspace/common/utils";
import ButtonContainer from "./sub-components/ButtonContainer";
import { Trans } from "react-i18next";
import { getPaymentLink } from "@docspace/common/api/portal";
const StyledBody = styled.div`
border-radius: 12px;
@ -99,16 +100,9 @@ const PriceCalculation = ({
CancelToken = axios.CancelToken;
source = CancelToken.source();
await axios
.put(
combineUrl(window.DocSpaceConfig?.proxy?.url, "/portal/payment/url"),
{ quantity: { admin: value } },
{
cancelToken: source.token,
}
)
.then((response) => {
setPaymentLink(response.data.response);
await getPaymentLink(value, source.token)
.then((link) => {
setPaymentLink(link);
setIsLoading(false);
})
.catch((thrown) => {

View File

@ -239,13 +239,14 @@ export function getPaymentAccount() {
return request({ method: "get", url: "/portal/payment/account" });
}
export function getPaymentLink(adminCount, currency) {
export function getPaymentLink(adminCount, cancelToken) {
return request({
method: "put",
url: `/portal/payment/url`,
data: {
quantity: { admin: adminCount },
},
cancelToken,
});
}

View File

@ -0,0 +1,33 @@
// (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.Files.Core.ApiModels.ResponseDto;
public class RoomSecurityDto
{
public IEnumerable<FileShareDto> Members { get; set; }
public string Warning { get; set; }
}

View File

@ -2486,12 +2486,13 @@ public class FileStorageService<T> //: IFileStorageService
return _fileSharing.GetSharedInfoShortFolderAsync(folderId);
}
public async Task SetAceObjectAsync(AceCollection<T> aceCollection, bool notify)
public async Task<string> SetAceObjectAsync(AceCollection<T> aceCollection, bool notify)
{
var fileDao = GetFileDao();
var folderDao = GetFolderDao();
var entries = new List<FileEntry<T>>();
string warning = null;
foreach (var fileId in aceCollection.Files)
{
@ -2507,7 +2508,9 @@ public class FileStorageService<T> //: IFileStorageService
{
try
{
var changed = await _fileSharingAceHelper.SetAceObjectAsync(aceCollection.Aces, entry, notify, aceCollection.Message, aceCollection.AdvancedSettings);
var (changed, warningMessage) = await _fileSharingAceHelper.SetAceObjectAsync(aceCollection.Aces, entry, notify, aceCollection.Message, aceCollection.AdvancedSettings);
warning ??= warningMessage;
if (changed)
{
foreach (var ace in aceCollection.Aces)
@ -2533,6 +2536,8 @@ public class FileStorageService<T> //: IFileStorageService
throw GenerateException(e);
}
}
return warning;
}
public async Task RemoveAceAsync(List<T> filesId, List<T> foldersId)
@ -2602,7 +2607,7 @@ public class FileStorageService<T> //: IFileStorageService
try
{
var changed = await _fileSharingAceHelper.SetAceObjectAsync(aces, room, false, null, null);
var (changed, _) = await _fileSharingAceHelper.SetAceObjectAsync(aces, room, false, null, null);
if (changed)
{
_filesMessageService.Send(room, GetHttpHeaders(), MessageAction.RoomInvintationUpdateAccess, room.Title, GetAccessString(share));
@ -2633,7 +2638,7 @@ public class FileStorageService<T> //: IFileStorageService
try
{
var changed = await _fileSharingAceHelper.SetAceObjectAsync(aces, file, false, null, null);
var (changed, _) = await _fileSharingAceHelper.SetAceObjectAsync(aces, file, false, null, null);
if (changed)
{
_filesMessageService.Send(file, GetHttpHeaders(), MessageAction.FileExternalLinkAccessUpdated, file.Title, GetAccessString(share));
@ -2767,16 +2772,18 @@ public class FileStorageService<T> //: IFileStorageService
try
{
var aces = new List<AceWrapper>
{
new AceWrapper
{
new AceWrapper
{
Access = FileShare.Read,
Id = recipient.Id,
SubjectGroup = false,
}
};
Access = FileShare.Read,
Id = recipient.Id,
SubjectGroup = false,
}
};
showSharingSettings |= await _fileSharingAceHelper.SetAceObjectAsync(aces, file, false, null, null);
var (changed, _) = await _fileSharingAceHelper.SetAceObjectAsync(aces, file, false, null, null);
showSharingSettings |= changed;
if (showSharingSettings)
{
foreach (var ace in aces)

View File

@ -30,14 +30,14 @@ public static class DocSpaceHelper
{
public static HashSet<FileShare> PaidRights { get; } = new HashSet<FileShare> { FileShare.RoomAdmin };
private static readonly HashSet<FileShare> _fillingFormRoomConstraints
= new HashSet<FileShare> { FileShare.RoomAdmin, FileShare.FillForms, FileShare.Read, FileShare.None };
private static readonly HashSet<FileShare> _collaborationRoomConstraints
= new HashSet<FileShare> { FileShare.RoomAdmin, FileShare.Editing, FileShare.Read, FileShare.None };
private static readonly HashSet<FileShare> _reviewRoomConstraints
= new HashSet<FileShare> { FileShare.RoomAdmin, FileShare.Review, FileShare.Comment, FileShare.Read, FileShare.None };
private static readonly HashSet<FileShare> _viewOnlyRoomConstraints
= new HashSet<FileShare> { FileShare.RoomAdmin, FileShare.Read, FileShare.None };
private static readonly List<FileShare> _fillingFormRoomRoles
= new List<FileShare> { FileShare.RoomAdmin, FileShare.FillForms, FileShare.Read, FileShare.None };
private static readonly List<FileShare> _collaborationRoomRoles
= new List<FileShare> { FileShare.RoomAdmin, FileShare.Editing, FileShare.Read, FileShare.None };
private static readonly List<FileShare> _reviewRoomRoles
= new List<FileShare> { FileShare.RoomAdmin, FileShare.Review, FileShare.Comment, FileShare.Read, FileShare.None };
private static readonly List<FileShare> _viewOnlyRoomRoles
= new List<FileShare> { FileShare.RoomAdmin, FileShare.Read, FileShare.None };
public static bool IsRoom(FolderType folderType)
{
@ -54,21 +54,29 @@ public static class DocSpaceHelper
return room != null && room.Private;
}
public static bool ValidateShare(FolderType folderType, FileShare fileShare, bool isUser)
public static bool ValidateShare(FolderType folderType, FileShare fileShare)
{
if (isUser && PaidRights.Contains(fileShare))
{
return false;
}
return folderType switch
{
FolderType.CustomRoom => true,
FolderType.FillingFormsRoom => _fillingFormRoomConstraints.Contains(fileShare),
FolderType.EditingRoom => _collaborationRoomConstraints.Contains(fileShare),
FolderType.ReviewRoom => _reviewRoomConstraints.Contains(fileShare),
FolderType.ReadOnlyRoom => _viewOnlyRoomConstraints.Contains(fileShare),
FolderType.FillingFormsRoom => _fillingFormRoomRoles.Contains(fileShare),
FolderType.EditingRoom => _collaborationRoomRoles.Contains(fileShare),
FolderType.ReviewRoom => _reviewRoomRoles.Contains(fileShare),
FolderType.ReadOnlyRoom => _viewOnlyRoomRoles.Contains(fileShare),
_ => false
};
}
public static FileShare GetHighFreeRole(FolderType folderType)
{
return folderType switch
{
FolderType.CustomRoom => FileShare.Editing,
FolderType.FillingFormsRoom => _fillingFormRoomRoles[1],
FolderType.EditingRoom => _collaborationRoomRoles[1],
FolderType.ReviewRoom => _reviewRoomRoles[1],
FolderType.ReadOnlyRoom => _viewOnlyRoomRoles[1],
_ => FileShare.None
};
}
}

View File

@ -661,7 +661,8 @@ public class FileUtility
".html", ".htm", ".mht", ".xml",
".pdf", ".djvu", ".fb2", ".epub", ".xps",".oxps",
".doct", ".docy",
".gdoc"
".gdoc",
".docxf", ".oform"
};
public static readonly List<string> ExtsFormTemplate = new List<string>

View File

@ -456,6 +456,15 @@ namespace ASC.Files.Core.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to The new version cannot be the same as the current one.
/// </summary>
public static string ErrorMassage_FileUpdateToVersion {
get {
return ResourceManager.GetString("ErrorMassage_FileUpdateToVersion", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You cannot copy the folder to its subfolder.
/// </summary>
@ -771,6 +780,15 @@ namespace ASC.Files.Core.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to The role is only available to a paid user.
/// </summary>
public static string ErrorMessage_PaidRole {
get {
return ResourceManager.GetString("ErrorMessage_PaidRole", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You don&apos;t have permission to copy to this folder.
/// </summary>

View File

@ -249,6 +249,9 @@
<data name="ErrorMassage_FileSizeMove" xml:space="preserve">
<value>File larger than {0} will not be moved</value>
</data>
<data name="ErrorMassage_FileUpdateToVersion" xml:space="preserve">
<value>The new version cannot be the same as the current one</value>
</data>
<data name="ErrorMassage_FolderCopyError" xml:space="preserve">
<value>You cannot copy the folder to its subfolder</value>
</data>
@ -354,6 +357,9 @@
<data name="ErrorMessage_InvintationLink" xml:space="preserve">
<value>The invitation link is invalid or it's validity has expired</value>
</data>
<data name="ErrorMessage_PaidRole" xml:space="preserve">
<value>The role is only available to a paid user</value>
</data>
<data name="ErrorMessage_SecurityException_CopyToFolder" xml:space="preserve">
<value>You don't have permission to copy to this folder</value>
</data>

View File

@ -1495,7 +1495,7 @@ public class EntryManager
}
}
public async Task<File<T>> UpdateToVersionFileAsync<T>(T fileId, int version, string doc = null, bool checkRight = true)
public async Task<File<T>> UpdateToVersionFileAsync<T>(T fileId, int version, string doc = null, bool checkRight = true, bool finalize = false)
{
var fileDao = _daoFactory.GetFileDao<T>();
if (version < 1)
@ -1519,6 +1519,13 @@ public class EntryManager
{
fromFile = await fileDao.GetFileAsync(fromFile.Id, Math.Min(fromFile.Version, version));
}
else
{
if (!finalize)
{
throw new Exception(FilesCommonResource.ErrorMassage_FileUpdateToVersion);
}
}
if (fromFile == null)
{
@ -1684,7 +1691,7 @@ public class EntryManager
{
if (fileVersion.Version == lastVersionFile.Version)
{
lastVersionFile = await UpdateToVersionFileAsync(fileVersion.Id, fileVersion.Version, null, checkRight);
lastVersionFile = await UpdateToVersionFileAsync(fileVersion.Id, fileVersion.Version, null, checkRight, true);
}
await fileDao.CompleteVersionAsync(fileVersion.Id, fileVersion.Version);

View File

@ -46,6 +46,7 @@ public class FileSharingAceHelper<T>
private readonly StudioNotifyService _studioNotifyService;
private readonly UsersInRoomChecker _usersInRoomChecker;
private readonly UserManagerWrapper _userManagerWrapper;
private readonly CountRoomAdminChecker _countRoomAdminChecker;
private readonly ILogger _logger;
public FileSharingAceHelper(
@ -65,7 +66,8 @@ public class FileSharingAceHelper<T>
StudioNotifyService studioNotifyService,
ILoggerProvider loggerProvider,
UsersInRoomChecker usersInRoomChecker,
UserManagerWrapper userManagerWrapper)
UserManagerWrapper userManagerWrapper,
CountRoomAdminChecker countRoomAdminChecker)
{
_fileSecurity = fileSecurity;
_coreBaseSettings = coreBaseSettings;
@ -84,9 +86,10 @@ public class FileSharingAceHelper<T>
_usersInRoomChecker = usersInRoomChecker;
_logger = loggerProvider.CreateLogger("ASC.Files");
_userManagerWrapper = userManagerWrapper;
_countRoomAdminChecker = countRoomAdminChecker;
}
public async Task<bool> SetAceObjectAsync(List<AceWrapper> aceWrappers, FileEntry<T> entry, bool notify, string message, AceAdvancedSettingsWrapper advancedSettings)
public async Task<(bool, string)> SetAceObjectAsync(List<AceWrapper> aceWrappers, FileEntry<T> entry, bool notify, string message, AceAdvancedSettingsWrapper advancedSettings)
{
if (entry == null)
{
@ -108,18 +111,27 @@ public class FileSharingAceHelper<T>
var recipients = new Dictionary<Guid, FileShare>();
var usersWithoutRight = new List<Guid>();
var changed = false;
string warning = null;
var shares = (await _fileSecurity.GetSharesAsync(entry)).ToList();
var i = 1;
foreach (var w in aceWrappers.OrderByDescending(ace => ace.SubjectGroup))
{
if (entry is Folder<T> folder && DocSpaceHelper.IsRoom(folder.FolderType) &&
!DocSpaceHelper.ValidateShare(folder.FolderType, w.Access, _userManager.IsUser(w.Id)))
!DocSpaceHelper.ValidateShare(folder.FolderType, w.Access))
{
continue;
}
if (!await ProcessEmailAceAsync(w))
if (_userManager.IsUser(w.Id) && DocSpaceHelper.PaidRights.Contains(w.Access))
{
throw new InvalidOperationException(FilesCommonResource.ErrorMessage_PaidRole);
};
var (success, msg) = await ProcessEmailAceAsync(w, entry);
warning ??= msg;
if (!success)
{
continue;
}
@ -253,7 +265,7 @@ public class FileSharingAceHelper<T>
await _fileMarker.RemoveMarkAsNewAsync(entry, userId);
}
return changed;
return (changed, warning);
}
public async Task RemoveAceAsync(FileEntry<T> entry)
@ -279,28 +291,49 @@ public class FileSharingAceHelper<T>
await _fileMarker.RemoveMarkAsNewAsync(entry);
}
private async Task<bool> ProcessEmailAceAsync(AceWrapper ace)
private async Task<(bool, string)> ProcessEmailAceAsync(AceWrapper ace, FileEntry<T> entry)
{
if (string.IsNullOrEmpty(ace.Email))
{
return true;
return (true, null);
}
var type = DocSpaceHelper.PaidRights.Contains(ace.Access) ? EmployeeType.RoomAdmin : EmployeeType.User;
UserInfo user = null;
var room = entry is Folder<T> folder && DocSpaceHelper.IsRoom(folder.FolderType) ? folder : null;
if (room == null)
{
return (false, null);
}
UserInfo user;
try
{
user = await _userManagerWrapper.AddInvitedUserAsync(ace.Email, type);
if (DocSpaceHelper.PaidRights.Contains(ace.Access))
{
await _countRoomAdminChecker.CheckAppend();
user = await _userManagerWrapper.AddInvitedUserAsync(ace.Email, EmployeeType.RoomAdmin);
}
else
{
user = await _userManagerWrapper.AddInvitedUserAsync(ace.Email, EmployeeType.User);
}
}
catch
catch(TenantQuotaException e)
{
return false;
ace.Access = DocSpaceHelper.GetHighFreeRole(room.FolderType);
user = await _userManagerWrapper.AddInvitedUserAsync(ace.Email, EmployeeType.User);
ace.Id = user.Id;
return (true, e.Message);
}
catch(Exception e)
{
return (false, e.Message);
}
ace.Id = user.Id;
return true;
return (true, null);
}
}

View File

@ -317,9 +317,11 @@ public abstract class VirtualRoomsController<T> : ApiControllerBase
/// Room security info
/// </returns>
[HttpPut("rooms/{id}/share")]
public async Task<IEnumerable<FileShareDto>> SetRoomSecurityAsync(T id, RoomInvitationRequestDto inDto)
public async Task<RoomSecurityDto> SetRoomSecurityAsync(T id, RoomInvitationRequestDto inDto)
{
ErrorIfNotDocSpace();
ErrorIfNotDocSpace();
var result = new RoomSecurityDto();
if (inDto.Invitations != null && inDto.Invitations.Any())
{
@ -333,10 +335,12 @@ public abstract class VirtualRoomsController<T> : ApiControllerBase
Message = inDto.Message
};
await _fileStorageService.SetAceObjectAsync(aceCollection, inDto.Notify);
}
result.Warning = await _fileStorageService.SetAceObjectAsync(aceCollection, inDto.Notify);
}
result.Members = await GetRoomSecurityInfoAsync(id).ToListAsync();
return await GetRoomSecurityInfoAsync(id).ToListAsync();
return result;
}
/// <summary>

View File

@ -2293,7 +2293,7 @@ namespace ASC.Web.Core.PublicResources {
}
/// <summary>
/// Looks up a localized string similar to The number of managers should not exceed {0}.
/// Looks up a localized string similar to The number of admins should not exceed {0}.
/// </summary>
public static string TariffsFeature_manager_exception {
get {

View File

@ -889,7 +889,7 @@
<value>The number of rooms should not exceed {0}</value>
</data>
<data name="TariffsFeature_manager_exception" xml:space="preserve">
<value>The number of managers should not exceed {0}</value>
<value>The number of admins should not exceed {0}</value>
</data>
<data name="TariffsFeature_total_size_exception" xml:space="preserve">
<value>The used storage size should not exceed {0}</value>
@ -930,4 +930,4 @@
<data name="ConsumersTelegramInstructionV11" xml:space="preserve">
<value>To receive portal notifications via Telegram, enable Telegram bot. You can create a new bot using BotFather in Telegram Desktop. To use this bot, portal users need to enable Telegram notifications on their Profile Page. {0}Paste bots username and the token you received in the fields below.</value>
</data>
</root>
</root>

View File

@ -1208,15 +1208,6 @@ Please follow the link below to change your mobile phone:
$GreenButton
If you do not want to change your mobile phone or received this email by mistake, please ignore it or contact your portal administrator to find out the details.</value>
</data>
<data name="pattern_personal_change_password_v115" xml:space="preserve">
<value>Want to change the password on your ONLYOFFICE Personal account? Click the button below to confirm.
$GreenButton
The link is valid for 7 days.
Dont want to change your password? Just ignore this message.</value>
</data>
<data name="subject_personal_already_exist" xml:space="preserve">
<value>Log in to your ONLYOFFICE Personal account</value>