forked from ddrilling/AsbCloudServer
36 lines
998 B
C#
36 lines
998 B
C#
using AsbCloudApp.Data;
|
|
using AsbCloudApp.Services;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AsbCloudWebApi.Controllers
|
|
{
|
|
[Route("api/admin/role")]
|
|
[ApiController]
|
|
[Authorize]
|
|
public class AdminUserRoleController : CrudController<UserRoleDto, IUserRoleService>
|
|
{
|
|
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) =>
|
|
{
|
|
var role = await service.GetAsync(id, token);
|
|
return role?.IdType == 1;
|
|
};
|
|
}
|
|
}
|
|
}
|