using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using zero.Core;
using zero.Core.Api;
using zero.Core.Entities;
using zero.Core.Identity;
using zero.Web.Mapper;
using zero.Web.Models;
namespace zero.Web.Controllers
{
[ZeroAuthorize(Permissions.Settings.Users, PermissionsValue.Read)]
public class UserRolesController : BackofficeController
{
private IUserRolesApi Api { get; set; }
public UserRolesController(IZeroConfiguration config, IUserRolesApi api, IMapper mapper, IToken token) : base(config, mapper, token)
{
Api = api;
}
///
/// Get role by id
///
public async Task GetById([FromQuery] string id)
{
return As(await Api.GetById(id));
}
///
/// Get all roles
///
public async Task GetAll()
{
return As(await Api.GetAll());
}
}
}