forked from ddrilling/AsbCloudServer
Правки после ревью
1. Поправил инициализацию ролей и прав 2. Поправил проверки в контроллере на редактирование РТК и ГГД 3. Пересоздал миграцию
This commit is contained in:
parent
dd9ffc57b3
commit
e451c0662c
@ -13,15 +13,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
[DbContext(typeof(AsbCloudDbContext))]
|
||||
[Migration("20230905071606_Add_New_Permissons")]
|
||||
partial class Add_New_Permissons
|
||||
[Migration("20230913063219_Add_New_Permissions")]
|
||||
partial class Add_New_Permissions
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.UseCollation("Russian_Russia.1251")
|
||||
.HasAnnotation("ProductVersion", "6.0.21")
|
||||
.HasAnnotation("ProductVersion", "6.0.22")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
|
||||
@ -3066,26 +3066,6 @@ namespace AsbCloudDb.Migrations
|
||||
IdPermission = 204
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 2009,
|
||||
IdPermission = 525
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 2009,
|
||||
IdPermission = 526
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 2013,
|
||||
IdPermission = 525
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 2013,
|
||||
IdPermission = 526
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 100
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Add_New_Permissons : Migration
|
||||
public partial class Add_New_Permissions : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -23,11 +23,7 @@ namespace AsbCloudDb.Migrations
|
||||
values: new object[,]
|
||||
{
|
||||
{ 525, 1 },
|
||||
{ 526, 1 },
|
||||
{ 525, 2009 },
|
||||
{ 526, 2009 },
|
||||
{ 525, 2013 },
|
||||
{ 526, 2013 }
|
||||
{ 526, 1 }
|
||||
});
|
||||
}
|
||||
|
||||
@ -43,26 +39,6 @@ namespace AsbCloudDb.Migrations
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 526, 1 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 525, 2009 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 526, 2009 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 525, 2013 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 526, 2013 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_permission",
|
||||
keyColumn: "id",
|
@ -3064,26 +3064,6 @@ namespace AsbCloudDb.Migrations
|
||||
IdPermission = 204
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 2009,
|
||||
IdPermission = 525
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 2009,
|
||||
IdPermission = 526
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 2013,
|
||||
IdPermission = 525
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 2013,
|
||||
IdPermission = 526
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 100
|
||||
|
@ -58,10 +58,6 @@ namespace AsbCloudDb.Model.DefaultData
|
||||
new (){ IdUserRole = 2005, IdPermission = 247}, new (){ IdUserRole = 2005, IdPermission = 205}, new (){ IdUserRole = 2005, IdPermission = 204},
|
||||
new (){ IdUserRole = 2006, IdPermission = 243}, new (){ IdUserRole = 2006, IdPermission = 205}, new (){ IdUserRole = 2006, IdPermission = 204},
|
||||
new (){ IdUserRole = 2007, IdPermission = 241}, new (){ IdUserRole = 2007, IdPermission = 205}, new (){ IdUserRole = 2007, IdPermission = 204},
|
||||
new (){ IdUserRole = 2009, IdPermission = 525}, new (){ IdUserRole = 2009, IdPermission = 526},
|
||||
new (){ IdUserRole = 2013, IdPermission = 525}, new (){ IdUserRole = 2013, IdPermission = 526},
|
||||
|
||||
//new (){ IdUserRole = 1, IdPermission = 500}, new (){ IdUserRole = 1, IdPermission = 501}, new (){ IdUserRole = 1, IdPermission = 502}, new (){ IdUserRole = 1, IdPermission = 503}, new (){ IdUserRole = 1, IdPermission = 504}, new (){ IdUserRole = 1, IdPermission = 505}, new (){ IdUserRole = 1, IdPermission = 506}, new (){ IdUserRole = 1, IdPermission = 510}, new (){ IdUserRole = 1, IdPermission = 511}, new (){ IdUserRole = 1, IdPermission = 512}, new (){ IdUserRole = 1, IdPermission = 513}, new (){ IdUserRole = 1, IdPermission = 514}, new (){ IdUserRole = 1, IdPermission = 515},
|
||||
};
|
||||
var allPermissions = (new EntityFillerPermission()).GetData();
|
||||
foreach ( var permission in allPermissions)
|
||||
|
@ -255,9 +255,12 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
var idUser = User.GetUserId();
|
||||
|
||||
if (!idUser.HasValue)
|
||||
return false;
|
||||
|
||||
var well = await wellService.GetOrDefaultAsync(idWell, token);
|
||||
|
||||
if (!idUser.HasValue || well is null)
|
||||
if (well is null)
|
||||
return false;
|
||||
|
||||
return well.IdState != 2 || userRepository.HasPermission(idUser.Value, "ProcessMap.editCompletedWell");
|
||||
|
@ -398,9 +398,12 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
var idUser = User.GetUserId();
|
||||
|
||||
if (!idUser.HasValue)
|
||||
return false;
|
||||
|
||||
var well = await wellService.GetOrDefaultAsync(idWell, token);
|
||||
|
||||
if (!idUser.HasValue || well is null)
|
||||
if (well is null)
|
||||
return false;
|
||||
|
||||
return well.IdState != 2 || userRepository.HasPermission(idUser.Value, "WellOperation.editCompletedWell");
|
||||
|
Loading…
Reference in New Issue
Block a user