Merge dev to HelpPages

This commit is contained in:
ngfrolov 2023-06-30 17:25:36 +05:00
commit 58a2519086
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
8 changed files with 8228 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Permissions_WellContact : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_permission",
columns: new[] { "id", "description", "name" },
values: new object[,]
{
{ 519, "Разрешение просматривать список контактов", "WellContact.get" },
{ 520, "Разрешение редактировать список контактов", "WellContact.edit" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_permission",
keyColumn: "id",
keyValue: 519);
migrationBuilder.DeleteData(
table: "t_permission",
keyColumn: "id",
keyValue: 520);
}
}
}

View File

@ -2052,7 +2052,7 @@ namespace AsbCloudDb.Migrations
}, },
new new
{ {
Id = 519, Id = 521,
Description = "Разрешить создание справок по страницам", Description = "Разрешить создание справок по страницам",
Name = "HelpPage.edit" Name = "HelpPage.edit"
}); });
@ -3626,7 +3626,7 @@ namespace AsbCloudDb.Migrations
new new
{ {
IdUserRole = 1, IdUserRole = 1,
IdPermission = 519 IdPermission = 521
}); });
}); });

View File

@ -11,12 +11,12 @@ namespace AsbCloudDb.Migrations
migrationBuilder.InsertData( migrationBuilder.InsertData(
table: "t_permission", table: "t_permission",
columns: new[] { "id", "description", "name" }, columns: new[] { "id", "description", "name" },
values: new object[] { 519, "Разрешить создание справок по страницам", "HelpPage.edit" }); values: new object[] { 521, "Разрешить создание справок по страницам", "HelpPage.edit" });
migrationBuilder.InsertData( migrationBuilder.InsertData(
table: "t_relation_user_role_permission", table: "t_relation_user_role_permission",
columns: new[] { "id_permission", "id_user_role" }, columns: new[] { "id_permission", "id_user_role" },
values: new object[] { 519, 1 }); values: new object[] { 521, 1 });
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
@ -24,12 +24,12 @@ namespace AsbCloudDb.Migrations
migrationBuilder.DeleteData( migrationBuilder.DeleteData(
table: "t_relation_user_role_permission", table: "t_relation_user_role_permission",
keyColumns: new[] { "id_permission", "id_user_role" }, keyColumns: new[] { "id_permission", "id_user_role" },
keyValues: new object[] { 519, 1 }); keyValues: new object[] { 521, 1 });
migrationBuilder.DeleteData( migrationBuilder.DeleteData(
table: "t_permission", table: "t_permission",
keyColumn: "id", keyColumn: "id",
keyValue: 519); keyValue: 521);
} }
} }
} }

View File

@ -2051,6 +2051,18 @@ namespace AsbCloudDb.Migrations
new new
{ {
Id = 519, Id = 519,
Description = "Разрешение просматривать список контактов",
Name = "WellContact.get"
},
new
{
Id = 520,
Description = "Разрешение редактировать список контактов",
Name = "WellContact.edit"
},
new
{
Id = 521,
Description = "Разрешить создание справок по страницам", Description = "Разрешить создание справок по страницам",
Name = "HelpPage.edit" Name = "HelpPage.edit"
}); });
@ -3625,6 +3637,16 @@ namespace AsbCloudDb.Migrations
{ {
IdUserRole = 1, IdUserRole = 1,
IdPermission = 519 IdPermission = 519
},
new
{
IdUserRole = 1,
IdPermission = 520
},
new
{
IdUserRole = 1,
IdPermission = 521
}); });
}); });

View File

@ -150,7 +150,10 @@
new (){ Id = 517, Name="FaqStatistics.edit", Description="Разрешение редактировать вопрос"}, new (){ Id = 517, Name="FaqStatistics.edit", Description="Разрешение редактировать вопрос"},
new (){ Id = 518, Name="FaqStatistics.delete", Description="Разрешение удалять вопрос"}, new (){ Id = 518, Name="FaqStatistics.delete", Description="Разрешение удалять вопрос"},
new() { Id = 519, Name = "HelpPage.edit", Description = "Разрешить создание справок по страницам" } new (){ Id = 519, Name="WellContact.get", Description="Разрешение просматривать список контактов"},
new (){ Id = 520, Name="WellContact.edit", Description="Разрешение редактировать список контактов"},
new() { Id = 521, Name = "HelpPage.edit", Description = "Разрешить создание справок по страницам" }
}; };
} }
} }

View File

@ -1,5 +1,4 @@
using AsbCloudApp.Data; using AsbCloudApp.Data;
using AsbCloudApp.Data.User;
using AsbCloudApp.Services; using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;

View File

@ -1,7 +1,6 @@
using AsbCloudApp.Exceptions; using AsbCloudApp.Exceptions;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System; using System;
using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace AsbCloudWebApi.Middlewares namespace AsbCloudWebApi.Middlewares
@ -36,12 +35,15 @@ namespace AsbCloudWebApi.Middlewares
context.Response.Clear(); context.Response.Clear();
context.Response.StatusCode = 403; context.Response.StatusCode = 403;
} }
catch (TaskCanceledException ex) catch (OperationCanceledException ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
} }
catch (Exception ex) // TODO: find explicit exception. Use Trace. Add body size to message. catch (Exception ex) // TODO: find explicit exception. Use Trace. Add body size to message.
{ {
context.Response.Clear();
context.Response.StatusCode = 500;
if (ex.Message.Contains("Reading the request body timed out due to data arriving too slowly. See MinRequestBodyDataRate.")) if (ex.Message.Contains("Reading the request body timed out due to data arriving too slowly. See MinRequestBodyDataRate."))
Console.WriteLine("Reading the request body timed out due to data arriving too slowly."); Console.WriteLine("Reading the request body timed out due to data arriving too slowly.");
else else