From ed1f32168a118fa4bdca2ea955c67b1462440544 Mon Sep 17 00:00:00 2001 From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:21:26 -0700 Subject: [PATCH] Addresses Brandon's concerns Adds the info missing from directory: - Department and/or student level - VMACS mobile - MIV ID - Photo use just the mailid portion of the email Fixes EmulateUser link Adds tooltip to buttons --- .../Controllers/DirectoryController.cs | 17 ++-- .../Models/IndividualSearchResult.cs | 19 +++-- .../Models/IndividualSearchResultCreator.cs | 2 + .../Models/IndividualSearchResultWithIDs.cs | 5 +- web/Areas/Directory/Services/VMACSService.cs | 5 +- web/Areas/Directory/Views/Card.cshtml | 78 ++++++++++++------- web/wwwroot/css/directory.css | 34 +++++--- 7 files changed, 101 insertions(+), 59 deletions(-) diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs index 39ebb6b..55b7498 100644 --- a/web/Areas/Directory/Controllers/DirectoryController.cs +++ b/web/Areas/Directory/Controllers/DirectoryController.cs @@ -87,11 +87,10 @@ public async Task>> Get(string var vmsearch = VMACSService.Search(results.Last().LoginId); var vm = vmsearch.Result; - if (vm != null && vm.item != null && vm.item.Nextel != null && vm.item.LDPager != null) - { - results.Last().Nextel = vm.item.Nextel[0]; - results.Last().LDPager = vm.item.LDPager[0]; - } + if (vm != null && vm.item != null && vm.item.Nextel != null) results.Last().Nextel = vm.item.Nextel[0]; + if (vm != null && vm.item != null && vm.item.LDPager != null) results.Last().LDPager = vm.item.LDPager[0]; + if (vm != null && vm.item != null && vm.item.Unit != null) results.Last().Department = vm.item.Unit[0]; + }); return results; } @@ -129,7 +128,13 @@ public async Task>> GetUCD(stri results.Add(hasDetailPermission ? new IndividualSearchResultWithIDs(userInfo, l) : new IndividualSearchResult(userInfo, l)); - }; + + var vmsearch = VMACSService.Search(results.Last().LoginId); + var vm = vmsearch.Result; + if (vm != null && vm.item != null && vm.item.Nextel != null) results.Last().Nextel = vm.item.Nextel[0]; + if (vm != null && vm.item != null && vm.item.LDPager != null) results.Last().LDPager = vm.item.LDPager[0]; + if (vm != null && vm.item != null && vm.item.Unit != null) results.Last().Department = vm.item.Unit[0]; + }; return results; } diff --git a/web/Areas/Directory/Models/IndividualSearchResult.cs b/web/Areas/Directory/Models/IndividualSearchResult.cs index aa93b5a..a81bda3 100644 --- a/web/Areas/Directory/Models/IndividualSearchResult.cs +++ b/web/Areas/Directory/Models/IndividualSearchResult.cs @@ -11,6 +11,7 @@ public class IndividualSearchResult public string ClientId { get; set; } = string.Empty; public string MothraId { get; set; } = string.Empty; public string? LoginId { get; set; } = string.Empty; + public string? Email { get; set; } = string.Empty; public string? MailId { get; set; } = string.Empty; public string? EmailHost { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty; @@ -57,7 +58,8 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta if (aaudUser != null) { MothraId = aaudUser.MothraId; LoginId = aaudUser.LoginId; - MailId = aaudUser.MailId; + Email = aaudUser.MailId; + MailId = aaudUser.MailId?.Split("@").First(); LastName = aaudUser.LastName; FirstName = aaudUser.FirstName; MiddleName = aaudUser.MiddleName; @@ -94,7 +96,8 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta Department = ldapUserContact.Ou; Phone = ldapUserContact.TelephoneNumber; Mobile = ldapUserContact.Mobile; - MailId = ldapUserContact.Mail; + Email = ldapUserContact.Mail; + MailId = ldapUserContact.Mail?.Split("@").First(); UserName = ldapUserContact.Uid; PostalAddress = (ldapUserContact.PostalAddress ?? "").Replace("$", '\n'.ToString()); UCDAffiliation = ldapUserContact.UcdPersonAffiliation; @@ -114,15 +117,11 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta { if (MailId != null) { - var split_mailid = MailId.Split('@'); - if (split_mailid.Length > 0) + var query = $"SELECT * FROM OPENQUERY(UCDMothra,'SELECT (USERPART || ''@'' || HOSTPART) AS USERATHOST FROM MOTHRA.MAILIDS WHERE MAILID = ''{MailId}'' AND MAILSTATUS = ''A'' AND MAILTYPE = ''P''')".ToString(); + var results = context.Database.SqlQuery(FormattableStringFactory.Create(query)).ToList(); + foreach (var r in results) { - var query = $"SELECT * FROM OPENQUERY(UCDMothra,'SELECT (USERPART || ''@'' || HOSTPART) AS USERATHOST FROM MOTHRA.MAILIDS WHERE MAILID = ''{split_mailid[0]}'' AND MAILSTATUS = ''A'' AND MAILTYPE = ''P''')".ToString(); - var results = context.Database.SqlQuery(FormattableStringFactory.Create(query)).ToList(); - foreach (var r in results) - { - EmailHost = r.Split("@").Last(); - } + EmailHost = r.Split("@").Last(); } } } diff --git a/web/Areas/Directory/Models/IndividualSearchResultCreator.cs b/web/Areas/Directory/Models/IndividualSearchResultCreator.cs index 0f2f570..b5354d9 100644 --- a/web/Areas/Directory/Models/IndividualSearchResultCreator.cs +++ b/web/Areas/Directory/Models/IndividualSearchResultCreator.cs @@ -1,5 +1,6 @@ using System.Runtime.Versioning; using Viper.Models.AAUD; +using System.Text.Json; namespace Viper.Areas.Directory.Models { @@ -40,6 +41,7 @@ public static IndividualSearchResult CreateIndividualSearchResult(AaudUser? aaud private static void AddAaudUser(IndividualSearchResult indiv, AaudUser aaudUser) { + indiv.originalObject = JsonSerializer.Serialize(aaudUser); indiv.MothraId = aaudUser.MothraId; indiv.LoginId = aaudUser.LoginId; indiv.MailId = aaudUser.MailId; diff --git a/web/Areas/Directory/Models/IndividualSearchResultWithIDs.cs b/web/Areas/Directory/Models/IndividualSearchResultWithIDs.cs index 36e082e..0a789f3 100644 --- a/web/Areas/Directory/Models/IndividualSearchResultWithIDs.cs +++ b/web/Areas/Directory/Models/IndividualSearchResultWithIDs.cs @@ -37,8 +37,9 @@ public IndividualSearchResultWithIDs(AaudUser? aaudUser, LdapUserContact? ldapUs UnexId = aaudUser.UnexId; MothraId = aaudUser.MothraId; IamId = aaudUser.IamId; - } - else if(ldapUserContact != null) + MivId = aaudUser.MivId; + } + else if(ldapUserContact != null) { Title = ldapUserContact.Title; Department = ldapUserContact.Ou; diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs index 9cd2a8f..2ed7627 100644 --- a/web/Areas/Directory/Services/VMACSService.cs +++ b/web/Areas/Directory/Services/VMACSService.cs @@ -26,7 +26,8 @@ public VMACSService() { } /// public static async Task Search (String? loginID) { - string request = $"/trust/query.xml?dbfile=3&index=CampusLoginId&find={loginID}&format=CHRIS4&AUTH=06232005".ToString(); + + string request = $"/trust/query.xml?dbfile=3&index=CampusLoginId&find={loginID}&format=CHRIS4&AUTH=06232005".ToString(); using HttpResponseMessage response = await sharedClient.GetAsync(request); if (response.IsSuccessStatusCode == false){ return null; @@ -38,7 +39,7 @@ public VMACSService() { } var serializer = new XmlSerializer(typeof(VMACSQuery)); //return Encoding.ASCII.GetString(stream.ToArray()); var vmacs_api = (VMACSQuery?)serializer.Deserialize(stream); - if (vmacs_api != null && vmacs_api.item != null && vmacs_api.item.Nextel != null) + if (vmacs_api != null && vmacs_api.item != null) { return vmacs_api; } diff --git a/web/Areas/Directory/Views/Card.cshtml b/web/Areas/Directory/Views/Card.cshtml index 1bf967d..f1b8cf7 100644 --- a/web/Areas/Directory/Views/Card.cshtml +++ b/web/Areas/Directory/Views/Card.cshtml @@ -35,10 +35,47 @@
- - - - + + + User Information + + + + + Emulate {{user.name}} + + + + AAUD Check + + + + ID Check + + + + MSO/CAO Lookup + + @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.DirectoryUCPathInfo")) + { + @: + + + UCPath Info + + } + @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.CATS.ServiceDesk")) + { + @: + + + Alt. Photo + + } + @@ -49,15 +86,16 @@
{{user.userName}}

{{user.name}}

{{user.title}}

+

{{user.department}}

{{user.ucdStudentLevel}}

SVM

- +
[{{user.emailHost}}]
Ph: {{ user.phone }}
M: {{ user.mobile }}
Pager: {{ user.ldpager }}
-
N: {{ user.nextel }}
+
M: {{ user.nextel }} (VMACS)
{{ user.postalAddress }}
@@ -65,7 +103,7 @@
- BannerID: + BannerID: @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents")) { @: {{ user.spridenId }} @@ -75,27 +113,11 @@ @: {{ user.spridenId }} }
-
PIDM: {{ user.pidm }}
-
EmployeeID: {{ user.employeeId}}
-
IAMID: {{ user.iamId }}
-
MothraID: {{ user.mothraId }}
-
MIVID: {{ user.mivId }}
-
- - - - - - @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.DirectoryUCPathInfo")) - { - @: - - } - @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.CATS.ServiceDesk")) - { - @: - Alt. Photo - } +
PIDM: {{ user.pidm }}
+
EmployeeID: {{ user.employeeId}}
+
IAMID: {{ user.iamId }}
+
MothraID: {{ user.mothraId }}
+
MIVID: {{ user.mivId }}
diff --git a/web/wwwroot/css/directory.css b/web/wwwroot/css/directory.css index d9845d7..57219f9 100644 --- a/web/wwwroot/css/directory.css +++ b/web/wwwroot/css/directory.css @@ -25,6 +25,16 @@ .directory .contact div, .directory .ids div, .directory .tools div { flex: 0 0 95%; } + .directory .ids div { + font-weight: bold; + } + .directory .ids div span { + font-weight: normal; + display: inline-block; + width: 85px; + text-align: right; + margin-right: 0; + } .directory .contact { margin-top: 1em; } @@ -43,6 +53,7 @@ max-width: 87px !important; padding: 2px; margin: 0; + margin-top: 22px; } .directory .photo_avatar { @@ -75,14 +86,15 @@ .directory h5 { font-size: 10px; } -.directory .userinfo_button, .directory .email_button { - color: #fff; - padding: 8px; -} -.directory .emulate_button { - color: #fff; - border: none; -} -.directory .emulate_button:before { - box-shadow: none; -} \ No newline at end of file + .directory .top_button { + color: #fff; + text-align: center; + line-height: 40px; + height: 40px; + width: 12%; + max-width: 40px; + color: #a4b5c8; + } + .directory .top_button:hover { + color: #fff; + }