mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
31 lines
807 B
C#
31 lines
807 B
C#
using System.Threading.Tasks;
|
|
using API.Entities;
|
|
using API.Interfaces;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace API.Controllers
|
|
{
|
|
public class AdminController : BaseApiController
|
|
{
|
|
private readonly IUserRepository _userRepository;
|
|
private readonly UserManager<AppUser> _userManager;
|
|
|
|
public AdminController(IUserRepository userRepository, UserManager<AppUser> userManager)
|
|
{
|
|
_userRepository = userRepository;
|
|
_userManager = userManager;
|
|
}
|
|
|
|
[HttpGet("exists")]
|
|
public async Task<ActionResult<bool>> AdminExists()
|
|
{
|
|
var users = await _userManager.GetUsersInRoleAsync("Admin");
|
|
return users.Count > 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
} |