output users + roles
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user