2021-11-25 11:55:52 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
2021-09-10 11:28:57 +05:00
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2022-02-01 17:58:31 +05:00
|
|
|
|
using System.Threading.Tasks;
|
2021-09-10 11:28:57 +05:00
|
|
|
|
|
|
|
|
|
namespace AsbCloudWebApi.Controllers
|
|
|
|
|
{
|
2021-12-03 09:44:10 +05:00
|
|
|
|
[Route("api/admin/role")]
|
2021-09-10 11:28:57 +05:00
|
|
|
|
[ApiController]
|
|
|
|
|
[Authorize]
|
2022-04-11 18:00:34 +05:00
|
|
|
|
public class AdminUserRoleController : CrudController<UserRoleDto, IUserRoleService>
|
2021-09-10 11:28:57 +05:00
|
|
|
|
{
|
2021-12-03 15:03:33 +05:00
|
|
|
|
public AdminUserRoleController(IUserRoleService service)
|
2022-04-11 18:00:34 +05:00
|
|
|
|
: base(service)
|
2021-12-03 15:03:33 +05:00
|
|
|
|
{
|
2022-02-01 17:58:31 +05:00
|
|
|
|
InsertForbidAsync = (role, token) =>
|
|
|
|
|
{
|
|
|
|
|
return Task.FromResult(role?.IdType == 1);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
UpdateForbidAsync = async (id, _, token) =>
|
|
|
|
|
{
|
|
|
|
|
var role = await service.GetAsync(id, token);
|
|
|
|
|
return role?.IdType == 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DeleteForbidAsync = async (id, token) =>
|
|
|
|
|
{
|
|
|
|
|
var role = await service.GetAsync(id, token);
|
|
|
|
|
return role?.IdType == 1;
|
|
|
|
|
};
|
2021-12-03 15:03:33 +05:00
|
|
|
|
}
|
2021-09-10 11:28:57 +05:00
|
|
|
|
}
|
|
|
|
|
}
|