using Connected.Security.Identity; namespace Connected.Security; public static class SecurityExtensions { public static string DisplayName(this IUser user) { if (user is null) return null; string fn = FullName(user.FirstName, user.LastName); if (!string.IsNullOrWhiteSpace(fn)) return fn; if (!string.IsNullOrWhiteSpace(user.LoginName)) return user.LoginName; if (user.Email?.Contains('@') == true) return user.Email[..user.Email.IndexOf('@')]; return user.Id.ToString(); } public static string FullName(string firstName, string lastName) { return $"{firstName} {lastName}".Trim(); } }