From b266f63cd740c470f9bc3360aa52ded46c3929cc Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 26 May 2026 06:17:53 -0400 Subject: [PATCH] feat(adminui): thread User.Identity.Name into Deployments createdBy (F18) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injects AuthenticationStateProvider and reads the current user's identity name on Deploy click, replacing the "(current user)" placeholder. Anonymous case falls back to "(anonymous)" — should never hit in practice since the page requires FleetAdmin/ConfigEditor. --- .../Components/Pages/Deployments.razor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Deployments.razor b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Deployments.razor index 573d1d6..be5ddca 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Deployments.razor +++ b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Deployments.razor @@ -1,5 +1,6 @@ @page "/deployments" @using Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Components.Authorization @using Microsoft.EntityFrameworkCore @using ZB.MOM.WW.OtOpcUa.Commons.Interfaces @using ZB.MOM.WW.OtOpcUa.Commons.Messages.Admin @@ -12,6 +13,7 @@ @inject IDbContextFactory DbFactory @inject IAdminOperationsClient AdminOps +@inject AuthenticationStateProvider AuthState @rendermode InteractiveServer Deployments @@ -103,8 +105,10 @@ _lastMessage = null; try { + var auth = await AuthState.GetAuthenticationStateAsync(); + var createdBy = auth.User.Identity?.Name ?? "(anonymous)"; var result = await AdminOps.StartDeploymentAsync( - createdBy: "(current user)", // F18: thread HttpContext.User.Identity.Name through + createdBy: createdBy, ct: CancellationToken.None); _lastSuccess = result.Outcome == StartDeploymentOutcome.Accepted;