@page "/user-audit"
@attribute [Authorize]
@inject IUserSessionService Session
@inject ISessionManager SessionMgr
@inject IUserAccessAuditService AuditSvc
@inject IGraphUserDirectoryService GraphSvc
@inject ISiteDiscoveryService SiteDiscovery
@inject UserAccessCsvExportService CsvExport
@inject UserAccessHtmlExportService HtmlExport
@inject WebExportService WebExport
@inject IAuditService Audit
@inject TranslationSource T
@rendermode InteractiveServer
@T["audit.hint.allSites"]
@if (_running) { }
@if (!string.IsNullOrEmpty(_error)) {
@T["audit.results.title"] @_results.Count
@if (_sitesScanned > 0)
{
@string.Format(T["audit.scan.sitesScanned"], _sitesScanned)
@if (_sitesDenied > 0) { @string.Format(T["audit.scan.sitesDenied"], _sitesDenied) }
@if (_sitesFailed > 0) { @string.Format(T["audit.scan.sitesFailed"], _sitesFailed) }
}
@if (_viewMode == "site")
{
@T["audit.bysite.hint"]
@foreach (var g in _results.GroupBy(r => (r.SiteUrl, r.SiteTitle)).OrderBy(g => g.Key.SiteTitle, StringComparer.OrdinalIgnoreCase))
{
var siteUrl = g.Key.SiteUrl;
var expanded = _expandedSites.Contains(siteUrl);
var hasHigh = g.Any(e => e.IsHighPrivilege);
@if (expanded)
{
@if (_multiUser) { | @T["report.col.user"] | }
@T["report.col.object"] |
@T["audit.col.permission"] |
@T["report.col.access_type"] |
@T["report.col.granted_through"] |
@foreach (var r in g)
{
@if (_multiUser) { | @r.UserDisplayName | }
@r.ObjectTitle (@r.ObjectType) |
@r.PermissionLevel @if (r.IsHighPrivilege) { @T["audit.chip.high"] } |
@r.AccessType |
@r.GrantedThrough |
}
}
}
}
else
{
| @T["report.col.user"] | @T["report.col.site"] | @T["report.col.object"] | @T["audit.col.permission"] | @T["report.col.access_type"] | @T["report.col.granted_through"] |
@foreach (var r in _results.Take(500))
{
| @r.UserDisplayName |
@r.SiteTitle |
@r.ObjectTitle (@r.ObjectType) |
@r.PermissionLevel @if (r.IsHighPrivilege) { @T["audit.chip.high"] } |
@r.AccessType |
@r.GrantedThrough |
}
@if (_results.Count > 500) {
@T["audit.msg.showFirst500Export"]
}
}
}
@code {
private string _users = string.Empty;
private bool _includeGuests, _loadingUsers;
private int _loadCount;
private string _userFilter = string.Empty;
private List