1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 00:52:49 -05:00

users listing page

This commit is contained in:
Kyle Spearrin
2018-03-21 16:24:10 -04:00
parent d35d8185ed
commit 67bf801c15
10 changed files with 234 additions and 7 deletions

View File

@ -0,0 +1,45 @@
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Bit.Core.Repositories;
using System.Threading.Tasks;
using Bit.Admin.Models;
using System.Collections.Generic;
using Bit.Core.Models.Table;
namespace Bit.Admin.Controllers
{
[Authorize]
public class UsersController : Controller
{
private readonly IUserRepository _userRepository;
public UsersController(IUserRepository userRepository)
{
_userRepository = userRepository;
}
public async Task<IActionResult> Index(string email, int page = 1, int count = 25)
{
if(page < 1)
{
page = 1;
}
if(count < 1)
{
count = 1;
}
var skip = (page - 1) * count;
var users = await _userRepository.SearchByEmailAsync(email, skip, count);
return View(new UsersModel
{
Users = users as List<User>,
Email = string.IsNullOrWhiteSpace(email) ? null : email,
Page = page,
Count = count
});
}
}
}