forked from ddrilling/AsbCloudServer
Fix AdminUserRoleController.*Forbid predicates.
This commit is contained in:
parent
c2608bb24b
commit
9876edcb9f
@ -14,21 +14,15 @@ namespace AsbCloudWebApi.Controllers
|
||||
public AdminUserRoleController(IUserRoleService service)
|
||||
: base(service)
|
||||
{
|
||||
InsertForbidAsync = (role, token) =>
|
||||
{
|
||||
return Task.FromResult(role?.IdType == 1);
|
||||
};
|
||||
|
||||
UpdateForbidAsync = async (dto, token) =>
|
||||
{
|
||||
var role = await service.GetAsync(dto.Id, token);
|
||||
return role?.IdType == 1;
|
||||
};
|
||||
|
||||
DeleteForbidAsync = async (id, token) =>
|
||||
DeleteForbidAsync = (id, token) =>
|
||||
{
|
||||
var role = await service.GetAsync(id, token);
|
||||
return role?.IdType == 1;
|
||||
return Task.FromResult(id == 1);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -127,6 +127,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns>1 - успешно удалено, 0 - нет</returns>
|
||||
[HttpDelete("{id}")]
|
||||
[Permission]
|
||||
public virtual async Task<ActionResult<int>> DeleteAsync(int id, CancellationToken token)
|
||||
{
|
||||
if (DeleteForbidAsync is not null && await DeleteForbidAsync(id, token))
|
||||
|
Loading…
Reference in New Issue
Block a user