Files
2026-03-09 12:53:15 -04:00

132 lines
4.3 KiB
Plaintext

@page
@model maintenance.Pages.Admin.Groups.IndexModel
@{
ViewData["Title"] = "Admin Groups";
}
<h1>Admin Groups</h1>
<p>
@if (Model.IsAdSource)
{
<text>Source: AD lookup + AuthorizationGroup records.</text>
}
else
{
<text>Source: MAX app database records.</text>
}
</p>
<form method="get" class="mb-4">
<div class="row g-2">
<div class="col-md-8">
@if (Model.IsAdSource)
{
<input asp-for="GroupSearch" class="form-control" placeholder="Search AD lookup groups by name" />
}
else
{
<input asp-for="GroupSearch" class="form-control" placeholder="Search added groups (case-insensitive)" />
}
</div>
<div class="col-md-4">
<button type="submit" class="btn btn-outline-primary">Search</button>
</div>
</div>
</form>
@if (Model.IsAdSource && Model.LookupResults.Count > 0)
{
<div class="mb-4">
<h5>Lookup Results</h5>
<table class="table table-sm">
<thead>
<tr>
<th>Group Name</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var result in Model.LookupResults)
{
<tr>
<td>@result</td>
<td>
<form method="post" asp-page-handler="AddFromLookup" style="display:inline">
<input type="hidden" name="groupName" value="@result" />
<input type="hidden" asp-for="GroupSearch" />
<button type="submit" class="btn btn-sm btn-success">Add as admin</button>
</form>
</td>
</tr>
}
</tbody>
</table>
</div>
}
<form method="post" asp-page-handler="Add" class="mb-4">
<div class="row g-2">
<div class="col-md-8">
<input asp-for="NewGroupClaimValue" class="form-control" placeholder="Group claim value" />
</div>
<div class="col-md-4">
<button type="submit" class="btn btn-primary">Add Group</button>
</div>
</div>
</form>
<table class="table table-striped">
<thead>
<tr>
<th>Group Claim Value</th>
@if (Model.IsAdSource)
{
<th>Role</th>
<th>Active</th>
}
<th></th>
</tr>
</thead>
<tbody>
@if (Model.IsAdSource)
{
@foreach (var g in Model.AdGroups)
{
<tr>
<td>@g.GroupClaimValue</td>
<td>@g.Role</td>
<td>@g.Active</td>
<td>
<form method="post" asp-page-handler="Toggle" style="display:inline">
<input type="hidden" name="id" value="@g.Id" />
<input type="hidden" asp-for="GroupSearch" />
<button type="submit" class="btn btn-sm btn-outline-secondary">Toggle</button>
</form>
<form method="post" asp-page-handler="Delete" style="display:inline">
<input type="hidden" name="id" value="@g.Id" />
<input type="hidden" asp-for="GroupSearch" />
<button type="submit" class="btn btn-sm btn-outline-danger">Remove</button>
</form>
</td>
</tr>
}
}
else
{
@foreach (var g in Model.Groups)
{
<tr>
<td>@g.GroupClaimValue</td>
<td>
<form method="post" asp-page-handler="Delete" style="display:inline">
<input type="hidden" name="id" value="@g.Id" />
<input type="hidden" asp-for="GroupSearch" />
<button type="submit" class="btn btn-sm btn-outline-danger">Remove</button>
</form>
</td>
</tr>
}
}
</tbody>
</table>