From 834d2f8fae7f090716788c5218ab9701c118d097 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Thu, 22 Jan 2026 15:20:23 +1100 Subject: [PATCH] feature: `#UserDetails[]` expression helper ignores hide/obfuscate mode symbols --- Disco.Services/Expressions/Expression.cs | 32 +++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Disco.Services/Expressions/Expression.cs b/Disco.Services/Expressions/Expression.cs index 34d93bb8..e012b66d 100644 --- a/Disco.Services/Expressions/Expression.cs +++ b/Disco.Services/Expressions/Expression.cs @@ -8,6 +8,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Text; namespace Disco.Services.Expressions @@ -200,18 +201,31 @@ namespace Disco.Services.Expressions var detailsService = new DetailsProviderService(Database); if (target != null) { + var detailsTarget = default(User); if (target is User targetUser) - { - detailsVariables.Add("UserDetails", new LazyDictionary(() => detailsService.GetDetails(targetUser))); - } + detailsTarget = targetUser; else if (target is Job targetJob) - { - detailsVariables.Add("UserDetails", targetJob.User == null ? (IDictionary)new Dictionary() : new LazyDictionary(() => detailsService.GetDetails(targetJob.User))); - } + detailsTarget = targetJob.User; else if (target is Device targetDevice) - { - detailsVariables.Add("UserDetails", targetDevice.AssignedUser == null ? (IDictionary)new Dictionary() : new LazyDictionary(() => detailsService.GetDetails(targetDevice.AssignedUser))); - } + detailsTarget = targetDevice.AssignedUser; + + if (detailsTarget != null) + detailsVariables.Add("UserDetails", new LazyDictionary(() => + { + var details = detailsService.GetDetails(detailsTarget); + foreach (var key in details.Keys.ToList()) + { + if (key.EndsWith("*") || key.EndsWith("&")) + { + var baseKey = key.Substring(0, key.Length - 1); + if (!details.ContainsKey(baseKey)) + details[baseKey] = details[key]; + } + } + return details; + })); + else + detailsVariables.Add("UserDetails", new Dictionary()); } return new Hashtable(detailsVariables)