This commit is contained in:
ngfrolov 2023-06-30 17:15:26 +05:00
commit bb8b530cbf
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
7 changed files with 8222 additions and 4 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

@ -2002,6 +2002,18 @@ namespace AsbCloudDb.Migrations
Id = 518,
Description = "Разрешение удалять вопрос",
Name = "FaqStatistics.delete"
},
new
{
Id = 519,
Description = "Разрешение просматривать список контактов",
Name = "WellContact.get"
},
new
{
Id = 520,
Description = "Разрешение редактировать список контактов",
Name = "WellContact.edit"
});
});
@ -3569,6 +3581,16 @@ namespace AsbCloudDb.Migrations
{
IdUserRole = 1,
IdPermission = 518
},
new
{
IdUserRole = 1,
IdPermission = 519
},
new
{
IdUserRole = 1,
IdPermission = 520
});
});

View File

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

View File

@ -95,7 +95,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
{
var entity = GetTelemetryCache()
.FirstOrDefault(t => t.Well?.Id == idWell);
if (entity.Well?.Timezone is not null && entity.TimeZone.Hours != entity.Well.Timezone.Hours)
if (entity?.Well?.Timezone is not null && entity.TimeZone.Hours != entity.Well.Timezone.Hours)
{
entity.TimeZone = entity.Well.Timezone;
//TODO: выдаем предупреждение!

View File

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

View File

@ -1,7 +1,6 @@
using AsbCloudApp.Exceptions;
using Microsoft.AspNetCore.Http;
using System;
using System.IO;
using System.Threading.Tasks;
namespace AsbCloudWebApi.Middlewares
@ -36,12 +35,15 @@ namespace AsbCloudWebApi.Middlewares
context.Response.Clear();
context.Response.StatusCode = 403;
}
catch (TaskCanceledException ex)
catch (OperationCanceledException ex)
{
Console.WriteLine(ex.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."))
Console.WriteLine("Reading the request body timed out due to data arriving too slowly.");
else