@page "/clusters/{ClusterId}/acls" @attribute [Authorize(Policy = AdminUiPolicies.AuthenticatedRead)] @rendermode RenderMode.InteractiveServer @using Microsoft.EntityFrameworkCore @using ZB.MOM.WW.OtOpcUa.AdminUI.Acls @using ZB.MOM.WW.OtOpcUa.Configuration @using ZB.MOM.WW.OtOpcUa.Configuration.Entities @inject IDbContextFactory DbFactory @inject IAclScopeService Scopes Cluster ACLs · OtOpcUa

ACLs · @ClusterId

New ACL grant
@if (_rows is null) {

Loading…

} else {
The Scope target column resolves each row against the current configuration. A row marked unresolved points at nothing — it is shipped in every deployment artifact but authorizes nobody, and the deploy gate rejects it. Open it and re-pick the scope.

@_rows.Count ACL row@(_rows.Count == 1 ? "" : "s")

@if (_rows.Count == 0) {
No ACL rows for this cluster.
} else {
@foreach (var a in _rows) { }
NodeAclId Principal Scope Scope target Permissions Notes Actions
@a.NodeAclId @a.Principal @if (_principals.TryGetValue(a.Principal, out var use) && !use.ReachesSomething) { no key } @a.ScopeKind @(a.ScopeId ?? "—") @if (_scopes.TryGetValue(a.NodeAclId, out var check)) { @if (check.Ok) {
@check.Message
} else {
unresolved
@check.Message
} }
@foreach (var perm in PermissionChips(a.PermissionFlags)) { @perm } @(string.IsNullOrEmpty(a.Notes) ? "" : DisplayText.Abbreviate(a.Notes, 60)) Edit
}
}
@code { [Parameter] public string ClusterId { get; set; } = ""; private List? _rows; private Dictionary _scopes = new(StringComparer.Ordinal); private Dictionary _principals = new(StringComparer.OrdinalIgnoreCase); protected override async Task OnInitializedAsync() { await using var db = await DbFactory.CreateDbContextAsync(); _rows = await db.NodeAcls.AsNoTracking() .Where(a => a.ClusterId == ClusterId) .OrderBy(a => a.NodeAclId) .ToListAsync(); // Resolve every row's scope and principal so an unresolved grant is visible from the list rather // than only at deploy time. One indexed lookup each; the distinct-principal grouping keeps the // key lookups down to the number of distinct principals, not the number of rows. foreach (var row in _rows) { _scopes[row.NodeAclId] = await Scopes.CheckScopeAsync(ClusterId, row.ScopeKind, row.ScopeId); } foreach (var principal in _rows.Select(r => r.Principal).Distinct(StringComparer.OrdinalIgnoreCase)) { _principals[principal] = await Scopes.CheckPrincipalAsync(principal); } } private static IEnumerable PermissionChips(ZB.MOM.WW.OtOpcUa.Configuration.Enums.NodePermissions flags) { foreach (var v in Enum.GetValues()) { // Skip None (zero) and composite values that aren't single bits. var n = (int)v; if (n == 0) continue; if ((n & (n - 1)) != 0) continue; if (flags.HasFlag(v)) yield return v.ToString(); } } }