From 5f1de8581fd109bf44d5cffd3a48a6b8fe7819b5 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Wed, 15 Jun 2022 16:01:50 +0500 Subject: [PATCH] Fix AdminUserRoleController.*Forbid predicates. --- AsbCloudWebApi/Controllers/AdminUserRoleController.cs | 6 +++--- AsbCloudWebApi/Controllers/CrudController.cs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/AsbCloudWebApi/Controllers/AdminUserRoleController.cs b/AsbCloudWebApi/Controllers/AdminUserRoleController.cs index b9a7b8cd..f20cafc2 100644 --- a/AsbCloudWebApi/Controllers/AdminUserRoleController.cs +++ b/AsbCloudWebApi/Controllers/AdminUserRoleController.cs @@ -16,19 +16,19 @@ namespace AsbCloudWebApi.Controllers { InsertForbidAsync = (role, token) => { - return Task.FromResult(role?.IdType == 1); + return Task.FromResult(role?.IdType != 1); }; UpdateForbidAsync = async (dto, token) => { var role = await service.GetAsync(dto.Id, token); - return role?.IdType == 1; + return role?.IdType != 1; }; DeleteForbidAsync = async (id, token) => { var role = await service.GetAsync(id, token); - return role?.IdType == 1; + return role?.IdType != 1; }; } } diff --git a/AsbCloudWebApi/Controllers/CrudController.cs b/AsbCloudWebApi/Controllers/CrudController.cs index 06c1e811..8c6df061 100644 --- a/AsbCloudWebApi/Controllers/CrudController.cs +++ b/AsbCloudWebApi/Controllers/CrudController.cs @@ -127,6 +127,7 @@ namespace AsbCloudWebApi.Controllers /// /// 1 - успешно удалено, 0 - нет [HttpDelete("{id}")] + [Permission] public virtual async Task> DeleteAsync(int id, CancellationToken token) { if (DeleteForbidAsync is not null && await DeleteForbidAsync(id, token))