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