-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathAutofillTriageController.cs
More file actions
54 lines (46 loc) · 1.39 KB
/
AutofillTriageController.cs
File metadata and controls
54 lines (46 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#nullable enable
using Bit.Admin.Enums;
using Bit.Admin.Models;
using Bit.Admin.Utilities;
using Bit.Core.Autofill.Repositories;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Admin.Controllers;
[Authorize]
public class AutofillTriageController : Controller
{
private readonly IAutofillTriageReportRepository _repo;
public AutofillTriageController(IAutofillTriageReportRepository repo)
=> _repo = repo;
[RequirePermission(Permission.User_List_View)]
public async Task<IActionResult> Index(int page = 1, int count = 25)
{
var skip = (page - 1) * count;
var reports = await _repo.GetActiveAsync(skip, count);
var model = new AutofillTriageModel
{
Items = reports.ToList(),
Page = page,
Count = count,
};
return View(model);
}
[RequirePermission(Permission.User_List_View)]
public async Task<IActionResult> Details(Guid id)
{
var report = await _repo.GetByIdAsync(id);
if (report is null)
{
return NotFound();
}
return View(report);
}
[HttpPost]
[ValidateAntiForgeryToken]
[RequirePermission(Permission.User_List_View)]
public async Task<IActionResult> Archive(Guid id)
{
await _repo.ArchiveAsync(id);
return RedirectToAction(nameof(Index));
}
}