Merge branch 'main' of https://git.azuze.fr/kawa/SharepointToolbox-Web
This commit is contained in:
@@ -8,33 +8,34 @@
|
||||
@inject HtmlExportService HtmlExport
|
||||
@inject WebExportService WebExport
|
||||
@inject IAuditService Audit
|
||||
@inject TranslationSource T
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<h1 class="page-title">Permissions Audit</h1>
|
||||
<h1 class="page-title">@T["perm.title"]</h1>
|
||||
|
||||
@if (!Session.HasProfile) { <NoProfilePrompt /> return; }
|
||||
|
||||
<div class="card">
|
||||
<div class="card-title">Scan Options</div>
|
||||
<div class="card-title">@T["grp.scan.opts"]</div>
|
||||
<SitePicker Profile="Session.CurrentProfile!" @bind-SelectedSites="_sites" />
|
||||
<div class="form-row mt-8">
|
||||
<div class="form-group" style="flex:0 0 auto">
|
||||
<label class="form-label">Folder Depth</label>
|
||||
<label class="form-label">@T["lbl.folder.depth"]</label>
|
||||
<input class="form-input" type="number" @bind="_folderDepth" min="0" max="999" style="width:80px" />
|
||||
</div>
|
||||
<div class="form-group" style="display:flex;align-items:center;gap:16px;padding-top:20px">
|
||||
<label><input type="checkbox" @bind="_includeInherited" /> Include inherited</label>
|
||||
<label><input type="checkbox" @bind="_scanFolders" /> Scan folders</label>
|
||||
<label><input type="checkbox" @bind="_includeSubsites" /> Include subsites</label>
|
||||
<label><input type="checkbox" @bind="_includeInherited" /> @T["chk.inherited.perms"]</label>
|
||||
<label><input type="checkbox" @bind="_scanFolders" /> @T["chk.scan.folders"]</label>
|
||||
<label><input type="checkbox" @bind="_includeSubsites" /> @T["chk.include.subsites"]</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-row mt-8">
|
||||
<button class="btn btn-primary" @onclick="RunScan" disabled="@_running">
|
||||
@(_running ? "Scanning…" : "Scan Sites")
|
||||
@(_running ? T["perm.btn.scanning"] : T["perm.btn.scan"])
|
||||
</button>
|
||||
@if (_running)
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||
<button class="btn btn-secondary" @onclick="Cancel">@T["btn.cancel"]</button>
|
||||
}
|
||||
</div>
|
||||
<ProgressPanel IsRunning="_running" StatusMessage="@_status" Current="_current" Total="_total" />
|
||||
@@ -49,21 +50,21 @@
|
||||
{
|
||||
<div class="card">
|
||||
<div class="flex-row">
|
||||
<div class="card-title">Results <span class="count-badge">@_results.Count</span></div>
|
||||
<div class="card-title">@T["perm.results"] <span class="count-badge">@_results.Count</span></div>
|
||||
<div class="spacer"></div>
|
||||
<MergeModeSelect Value="_mergeMode" ValueChanged="v => _mergeMode = v" Visible="_bySite.Count > 1" />
|
||||
<button class="btn btn-secondary btn-sm" @onclick="ExportCsv">Export CSV</button>
|
||||
<button class="btn btn-secondary btn-sm" @onclick="ExportHtml">Export HTML</button>
|
||||
<button class="btn btn-secondary btn-sm" @onclick="ExportCsv">@T["audit.btn.exportCsv"]</button>
|
||||
<button class="btn btn-secondary btn-sm" @onclick="ExportHtml">@T["audit.btn.exportHtml"]</button>
|
||||
</div>
|
||||
<div class="data-table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Title</th>
|
||||
<th>Users</th>
|
||||
<th>Permission</th>
|
||||
<th>Granted Through</th>
|
||||
<th>@T["directory.col.type"]</th>
|
||||
<th>@T["report.col.title"]</th>
|
||||
<th>@T["perm.col.users"]</th>
|
||||
<th>@T["perm.col.permission"]</th>
|
||||
<th>@T["report.col.granted_through"]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -82,7 +83,7 @@
|
||||
</div>
|
||||
@if (_results.Count > 500)
|
||||
{
|
||||
<div class="text-muted mt-8">Showing first 500 of @_results.Count rows. Export for full results.</div>
|
||||
<div class="text-muted mt-8">@string.Format(T["perm.status.showing_first"], _results.Count)</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -105,7 +106,7 @@
|
||||
{
|
||||
_error = string.Empty; _results = new(); _bySite = new(); _running = true;
|
||||
_cts = new CancellationTokenSource();
|
||||
if (_sites.Count == 0) { _error = "Please select at least one site."; _running = false; return; }
|
||||
if (_sites.Count == 0) { _error = T["err.no_sites_selected"]; _running = false; return; }
|
||||
var progress = new Progress<OperationProgress>(p => { _status = p.Message; _current = p.Current; _total = p.Total; InvokeAsync(StateHasChanged); });
|
||||
try
|
||||
{
|
||||
@@ -116,7 +117,7 @@
|
||||
foreach (var site in _sites)
|
||||
{
|
||||
_cts.Token.ThrowIfCancellationRequested();
|
||||
_status = $"Scanning {site.Title} ({++i}/{_sites.Count})…";
|
||||
_status = string.Format(T["perm.status.scanning_site"], site.Title, ++i, _sites.Count);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
var entries = await Elevation.RunAsync(async c =>
|
||||
{
|
||||
@@ -127,11 +128,11 @@
|
||||
flat.AddRange(entries);
|
||||
}
|
||||
_bySite = bySite; _results = flat;
|
||||
_status = $"Scan complete: {_results.Count} entries across {_sites.Count} site(s).";
|
||||
_status = string.Format(T["perm.status.scan_complete"], _results.Count, _sites.Count);
|
||||
await Audit.LogAsync("PermissionsScan", Session.CurrentProfile?.Name ?? "", _sites.Select(s => s.Url),
|
||||
$"{_results.Count} entries; inherited={_includeInherited} folders={_scanFolders} depth={_folderDepth} subsites={_includeSubsites}");
|
||||
}
|
||||
catch (OperationCanceledException) { _status = "Cancelled."; }
|
||||
catch (OperationCanceledException) { _status = T["status.cancelled"]; }
|
||||
catch (Exception ex) { _error = ex.Message; }
|
||||
finally { _running = false; await InvokeAsync(StateHasChanged); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user