output users + roles

This commit is contained in:
2020-04-24 12:46:25 +02:00
parent a44cc4b04d
commit 76e95d34f3
18 changed files with 430 additions and 99 deletions
@@ -0,0 +1,40 @@
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;
}
/// <summary>
/// Get role by id
/// </summary>
public async Task<IActionResult> GetById([FromQuery] string id)
{
return As<UserRole, UserRoleEditModel>(await Api.GetById(id));
}
/// <summary>
/// Get all roles
/// </summary>
public async Task<IActionResult> GetAll()
{
return As<UserRole, UserRoleListModel>(await Api.GetAll());
}
}
}