+
+
+
+
+
@@ -47,55 +56,51 @@
SVM
-
-
-
-
-
+
+
+
+ - {{ user.postalAddress }}
+ - Phone: {{ user.phone }}
+ - Mobile: {{ user.mobile }}
+
-
-
+
+
- - 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
- }
+ -
+ BannerID:
+ @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
+ {
+ @: {{ user.spridenId }}
+ }
+ else
+ {
+ @: {{ user.spridenId }}
+ }
+
+ - PIDM: {{ user.pidm }}
+ - EmployeeID: {{ user.employeeId}}
+ - IAMID: {{ user.iamId }}
+ - MothraID: {{ user.mothraId }}
+ - MIVID: {{ user.mivId }}
-
-
+
+
- -
- BannerID:
- @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
+
- AAUD Check
+ - ID Check
+ - MSO/CAO Lookup
+ @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.DirectoryUCPathInfo"))
{
- @: {{ user.spridenId }}
+ @:
+ - UCPath Info
}
- else
+ @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.CATS.ServiceDesk"))
{
- @: {{ user.spridenId }}
+ @:
+ - Alt. Photo
}
-
- - PIDM: {{ user.pidm }}
- - EmployeeID: {{ user.employeeId}}
- - IAMID: {{ user.iamId }}
- - MothraID: {{ user.mothraId }}
- - MIVID: {{ user.mivId }}
-
-
-
-
-
- - {{ user.postalAddress }}
- - Phone: {{ user.phone }}
- - Mobile: {{ user.mobile }}
@@ -108,6 +113,7 @@
return {
userSearch: getItemFromStorage("directory_search") ?? "",
ucd: getItemFromStorage("directory_ucd") ?? false,
+ ids: getItemFromStorage("directory_ids") ?? false,
results: []
}
},
@@ -135,6 +141,11 @@
putItemInStorage("directory_search", this.userSearch);
putItemInStorage("directory_ucd", this.ucd);
this.findUsers();
+ },
+ ids: function () {
+ putItemInStorage("directory_search", this.userSearch);
+ putItemInStorage("directory_ids", this.ids);
+ this.findUsers();
}
}
})
diff --git a/web/Areas/Directory/Views/Index.cshtml b/web/Areas/Directory/Views/Index.cshtml
index c4525ea..f939a45 100644
--- a/web/Areas/Directory/Views/Index.cshtml
+++ b/web/Areas/Directory/Views/Index.cshtml
@@ -21,6 +21,10 @@
color="green"
label="Search all of UCD">
+
+
Date: Thu, 21 Mar 2024 15:31:11 -0700
Subject: [PATCH 13/69] Adding some autofocus and some filter saving
---
.../RAPS/Views/Permissions/ListAdmin.cshtml | 17 +++++++++++++++++
web/Areas/RAPS/Views/Permissions/Members.cshtml | 2 +-
web/Areas/RAPS/Views/Roles/ListAdmin.cshtml | 17 +++++++++++++++++
web/Areas/RAPS/Views/Roles/Members.cshtml | 2 +-
4 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/web/Areas/RAPS/Views/Permissions/ListAdmin.cshtml b/web/Areas/RAPS/Views/Permissions/ListAdmin.cshtml
index b9bf4c3..867d740 100644
--- a/web/Areas/RAPS/Views/Permissions/ListAdmin.cshtml
+++ b/web/Areas/RAPS/Views/Permissions/ListAdmin.cshtml
@@ -79,7 +79,24 @@
}
},
mounted() {
+ var f = getItemFromStorage("RAPS_permission_filter")
+ if (f) {
+ this.permissionTable.filter = f
+ }
+ var p = getItemFromStorage("RAPS_permission_pagination")
+ if (p) {
+ this.permissionTable.pagination = p
+ }
this.permissionTable.load(this)
+ },
+ watch: {
+ permissionTable: {
+ handler(v) {
+ putItemInStorage("RAPS_permission_filter", v.filter)
+ putItemInStorage("RAPS_permission_pagination", v.pagination)
+ },
+ deep: true
+ }
}
})
diff --git a/web/Areas/RAPS/Views/Permissions/Members.cshtml b/web/Areas/RAPS/Views/Permissions/Members.cshtml
index 0177488..ccc4805 100644
--- a/web/Areas/RAPS/Views/Permissions/Members.cshtml
+++ b/web/Areas/RAPS/Views/Permissions/Members.cshtml
@@ -23,7 +23,7 @@
-
diff --git a/web/Areas/RAPS/Views/Roles/Members.cshtml b/web/Areas/RAPS/Views/Roles/Members.cshtml
index 4ccbd64..93bec09 100644
--- a/web/Areas/RAPS/Views/Roles/Members.cshtml
+++ b/web/Areas/RAPS/Views/Roles/Members.cshtml
@@ -24,7 +24,7 @@
-
Date: Tue, 16 Apr 2024 07:21:49 -0700
Subject: [PATCH 14/69] Testing VMACS API
---
.../Models/IndividualSearchResult.cs | 18 ++-
web/Areas/Directory/Services/VMACSService.cs | 120 ++++++++++++++++++
web/Areas/Directory/Views/CardExample.cshtml | 118 +++++++++--------
3 files changed, 202 insertions(+), 54 deletions(-)
diff --git a/web/Areas/Directory/Models/IndividualSearchResult.cs b/web/Areas/Directory/Models/IndividualSearchResult.cs
index e9df58d..fa38963 100644
--- a/web/Areas/Directory/Models/IndividualSearchResult.cs
+++ b/web/Areas/Directory/Models/IndividualSearchResult.cs
@@ -1,4 +1,7 @@
-using System.Runtime.Versioning;
+using Microsoft.EntityFrameworkCore;
+using System.Runtime.CompilerServices;
+using System.Runtime.Versioning;
+using Viper.Areas.Directory.Services;
using Viper.Areas.RAPS.Models;
using Viper.Models.AAUD;
@@ -9,10 +12,12 @@ public class IndividualSearchResult
public string ClientId { get; set; } = string.Empty;
public string MothraId { get; set; } = string.Empty;
+ public string UCDPersonUUID { get; set; } = string.Empty;
public string? LoginId { 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;
@@ -114,6 +119,7 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
UserName = ldapUserContact.uid;
PostalAddress = (ldapUserContact.postaladdress ?? "").Replace("$", '\n'.ToString());
UCDAffiliation = ldapUserContact.ucdpersonaffiliation;
+ UCDPersonUUID = ldapUserContact.ucdpersonuuid;
if (string.IsNullOrEmpty(DisplayFullName))
{
DisplayFullName = ldapUserContact.displayname;
@@ -123,6 +129,16 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
Name = ldapUserContact.displayname;
}
}
+ using (var context = new Classes.SQLContext.AAUDContext())
+ {
+ var query = $"SELECT * FROM OPENQUERY(UCDMothra,'SELECT (USERPART || ''@'' || HOSTPART) AS USERATHOST FROM MOTHRA.MAILIDS WHERE MOTHRAID = ''{MothraId}'' AND MAILID = ''{MailId}'' AND MAILSTATUS = ''A'' AND MAILTYPE = ''P''')".ToString();
+ var results = context.Database.SqlQuery(FormattableStringFactory.Create(query)).ToList();
+ foreach (var r in results)
+ {
+ EmailHost = r;
+ }
+ }
+ VMACSService.Search(LoginId);
}
}
}
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index dac3f06..89f686a 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -1,9 +1,129 @@
using Microsoft.AspNetCore.Mvc;
+using System.DirectoryServices.AccountManagement;
+using System.DirectoryServices;
+using Viper.Areas.RAPS.Models;
+using System.Net.Http;
+using System.Text;
+using System.Xml.Serialization;
namespace Viper.Areas.Directory.Services
{
public class VMACSService
{
+ //private const string _ldapUsername = "uid=vetmed,ou=Special Users,dc=ucdavis,dc=edu";
+ private static HttpClient sharedClient = new()
+ {
+ BaseAddress = new Uri("https://vmacs-vmth.vetmed.ucdavis.edu"),
+ };
+ /*
+
+ *
+ */
+ [XmlRoot("query/item")]
+ public class VMACS_API
+ {
+ [XmlElement("name")]
+ public string[]? Name { get; set; }
+ [XmlElement("UserID")]
+ public string[]? VMACSID { get; set; }
+ [XmlElement("Unit")]
+ public string[]? Unit { get; set; }
+ [XmlElement("Home")]
+ public string[]? Home { get; set; }
+ [XmlElement("Nextel")]
+ public string[]? Nextel { get; set; }
+ [XmlElement("Status")]
+ public string[]? Status { get; set; }
+ [XmlElement("Campus_LoginID")]
+ public string[]? Campus_LoginID { get; set; }
+ [XmlElement("Email_Forward")]
+ public string[]? Email_Forward { get; set; }
+ }
+
+ public VMACSService() { }
+
+ ///
+ ///
+ ///
+ ///
+ public static async void Search (String? loginID)
+ {
+ string request = $"/trust/query.xml?dbfile=3&index=CampusLoginId&find={loginID}&format=CHRIS4&AUTH=06232005".ToString();
+ using HttpResponseMessage response = await sharedClient.GetAsync(request);
+ var s = await response.Content.ReadAsStringAsync();
+ var buffer = Encoding.UTF8.GetBytes(s);
+ using (var stream = new MemoryStream(buffer))
+ {
+ var serializer = new XmlSerializer(typeof(VMACS_API));
+ var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
+
+ }
+ var jsonResponse = await response.Content.ReadAsStringAsync();
+ Console.WriteLine($"{jsonResponse}\n");
+
+
+ }
+
+
+ /*
+ * var result = "";
+ var contacts = {LDPager="", Nextel="", LastEdit=""};
+ cfhttp(url="https://vmacs-vmth.vetmed.ucdavis.edu/trust/query.xml?dbfile=3&index=CampusLoginId&find=#loginID#&format=CHRIS4&AUTH=06232005",
+ method="get", timeout="2", result="result") {}
+
+ //the number of try/catch block here could be reduced by using more xml functions to check if something exists?
+ try {
+ var data = xmlSearch(xmlParse(result.FileContent),"/query/item");
+ var exp = "";
+ var lastEdit = "";
+ //most users only have one, but in some cases, multiple accounts exist.
+ //grab the latest edited, non-expired record.
+ for(var d in data) {
+ if(d?.Campus_LoginID?.XmlText == loginID) { //mvt (Megan Rott) matches mvthomps (not Megan Rott)
+ //try to get dates - if this fails, assume the record is active and was lastedited today
+ try {
+ exp = getDateFromVmacsString(d.Deactive.XmlText);
+ lastEdit = getDateFromVmacsString(d.LastEdit.XmlText);
+ }
+ catch(Any e) {
+ exp = dateAdd("yyyy", 1, now());
+ lastEdit = now();
+ }
+
+ if(exp > now() && (!isValid("date", contacts.LastEdit) || lastEdit > contacts.LastEdit)) {
+ contacts.lastEdit = lastEdit;
+
+ //individual tries in case these fields don't exist
+ try {
+ contacts.LDPager = d.LDPager.XmlText;
+ if(contacts.LDPager != "") {
+ contacts.LDPager = "1-530-" & contacts.LDPager;
+ }
+ }
+ catch(Any e) {}
+
+ try {
+ contacts.Nextel = d.Nextel.XmlText;
+ }
+ catch(Any e) {}
+ }
+ }
+ }
+ }
+ catch(Any e) {}
+ return contacts;
+
+ */
+
+ /*
+ ///
+ ///
+ /// Partial name of group to search for
+ /// List of groups
+ public List GetGroups(string? name = null)
+ {
+ }
+ */
}
}
diff --git a/web/Areas/Directory/Views/CardExample.cshtml b/web/Areas/Directory/Views/CardExample.cshtml
index 64eb80b..0822877 100644
--- a/web/Areas/Directory/Views/CardExample.cshtml
+++ b/web/Areas/Directory/Views/CardExample.cshtml
@@ -25,18 +25,21 @@
color="blue"
label="Display IDs">
+
+
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
@@ -48,60 +51,63 @@
{{user.title}}
{{user.userName}}
SVM
-
-
-
-
-
- - {{ user.postalAddress }}
- - Phone: {{ user.phone }}
- - Mobile: {{ user.mobile }}
-
-
-
-
-
- -
- BannerID:
- @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
+
+
+
{{ user.postalAddress }}
+ {{ user.phone }}
+ {{ user.mobile }}
+
+
+
+
+ -
+ BannerID:
+ @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
+ {
+ @: {{ user.spridenId }}
+ }
+ else
+ {
+ @: {{ user.spridenId }}
+ }
+
+ - PIDM: {{ user.pidm }}
+ - EmployeeID: {{ user.employeeId}}
+ - IAMID: {{ user.iamId }}
+ - MothraID: {{ user.mothraId }}
+ - MIVID: {{ user.mivId }}
+
+
+
+
+
- - PIDM: {{ user.pidm }}
- - EmployeeID: {{ user.employeeId}}
- - IAMID: {{ user.iamId }}
- - MothraID: {{ user.mothraId }}
- - MIVID: {{ user.mivId }}
-
-
-
-
-
- - 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
- }
-
+
+
+
+
+
+ {{ JSON.stringify(JSON.parse(user.originalObject), null, 2) }}
+
+
@@ -114,6 +120,7 @@
userSearch: getItemFromStorage("directory_search") ?? "",
ucd: getItemFromStorage("directory_ucd") ?? false,
ids: getItemFromStorage("directory_ids") ?? false,
+ debug: getItemFromStorage("directory_debug") ?? false,
results: []
}
},
@@ -146,6 +153,11 @@
putItemInStorage("directory_search", this.userSearch);
putItemInStorage("directory_ids", this.ids);
this.findUsers();
+ },
+ debug: function () {
+ putItemInStorage("directory_search", this.userSearch);
+ putItemInStorage("directory_debug", this.ids);
+ this.findUsers();
}
}
})
From 13d72452913fc5c7495ac85d599da9f2632095dd Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Tue, 16 Apr 2024 14:33:16 -0700
Subject: [PATCH 15/69] Testing API
---
.../Controllers/DirectoryController.cs | 1 -
.../Models/IndividualSearchResult.cs | 10 +-
web/Areas/Directory/Services/VMACSService.cs | 17 ++--
web/Areas/Directory/Views/CardExample.cshtml | 95 ++++++++++---------
4 files changed, 68 insertions(+), 55 deletions(-)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index 939ff70..d7b7347 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -13,7 +13,6 @@
namespace Viper.Areas.Directory.Controllers
{
[Area("Directory")]
- [Authorize(Roles = "VMDO SVM-IT", Policy = "2faAuthentication")]
[Permission(Allow = "SVMSecure")]
public class DirectoryController : AreaController
{
diff --git a/web/Areas/Directory/Models/IndividualSearchResult.cs b/web/Areas/Directory/Models/IndividualSearchResult.cs
index fa38963..ae07c5f 100644
--- a/web/Areas/Directory/Models/IndividualSearchResult.cs
+++ b/web/Areas/Directory/Models/IndividualSearchResult.cs
@@ -64,6 +64,7 @@ public class IndividualSearchResult
public DateTime? Added { get; set; } = null!;
public string? Phone { get; set; } = null!;
+ public string? Nextel { get; set; } = null!;
public string? Mobile { get; set; } = null!;
public string? PostalAddress { get; set; } = null!;
public string? UCDAffiliation { get; set; } = null!;
@@ -80,7 +81,7 @@ public IndividualSearchResult()
public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserContact)
{
SVM = false;
- if (aaudUser != null) {
+ if (aaudUser != null) {
MothraId = aaudUser.MothraId;
LoginId = aaudUser.LoginId;
MailId = aaudUser.MailId;
@@ -120,7 +121,7 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
PostalAddress = (ldapUserContact.postaladdress ?? "").Replace("$", '\n'.ToString());
UCDAffiliation = ldapUserContact.ucdpersonaffiliation;
UCDPersonUUID = ldapUserContact.ucdpersonuuid;
- if (string.IsNullOrEmpty(DisplayFullName))
+ if (string.IsNullOrEmpty(DisplayFullName))
{
DisplayFullName = ldapUserContact.displayname;
}
@@ -135,10 +136,11 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
var results = context.Database.SqlQuery(FormattableStringFactory.Create(query)).ToList();
foreach (var r in results)
{
- EmailHost = r;
+ EmailHost = r.Split("@").Last();
}
}
- VMACSService.Search(LoginId);
+ Task vmsearch = VMACSService.Search(LoginId);
+ Nextel = vmsearch.Result;
}
}
}
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index 89f686a..f1558d1 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -5,6 +5,7 @@
using System.Net.Http;
using System.Text;
using System.Xml.Serialization;
+using Microsoft.CodeAnalysis.Elfie.Model.Strings;
namespace Viper.Areas.Directory.Services
{
@@ -32,6 +33,8 @@ public class VMACS_API
public string[]? Home { get; set; }
[XmlElement("Nextel")]
public string[]? Nextel { get; set; }
+ [XmlElement("LDPager")]
+ public string[]? LDPager { get; set; }
[XmlElement("Status")]
public string[]? Status { get; set; }
[XmlElement("Campus_LoginID")]
@@ -46,22 +49,24 @@ public VMACSService() { }
///
///
///
- public static async void Search (String? loginID)
+ public static async Task Search (String? loginID)
{
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;
+ }
var s = await response.Content.ReadAsStringAsync();
var buffer = Encoding.UTF8.GetBytes(s);
using (var stream = new MemoryStream(buffer))
{
var serializer = new XmlSerializer(typeof(VMACS_API));
var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
-
+ if (vmacs_api != null && vmacs_api.Nextel != null){
+ return vmacs_api.Nextel[0];
+ }
}
- var jsonResponse = await response.Content.ReadAsStringAsync();
- Console.WriteLine($"{jsonResponse}\n");
-
-
+ return null;
}
diff --git a/web/Areas/Directory/Views/CardExample.cshtml b/web/Areas/Directory/Views/CardExample.cshtml
index 0822877..bd19a83 100644
--- a/web/Areas/Directory/Views/CardExample.cshtml
+++ b/web/Areas/Directory/Views/CardExample.cshtml
@@ -32,58 +32,65 @@
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+ {{user.name}}
+
+
+ {{user.title}}
+
+
+
-
-
- {{user.name}}
-
-
- {{user.title}}
-
-
-
+
+
{{user.userName}}
+
SVM
-
-
- {{ user.postalAddress }}
- {{ user.phone }}
- {{ user.mobile }}
-
-
-
-
- -
- BannerID:
- @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
- {
- @: {{ user.spridenId }}
- }
- else
- {
- @: {{ user.spridenId }}
- }
-
- - PIDM: {{ user.pidm }}
- - EmployeeID: {{ user.employeeId}}
- - IAMID: {{ user.iamId }}
- - MothraID: {{ user.mothraId }}
- - MIVID: {{ user.mivId }}
-
-
+
+
+
+ {{ user.postalAddress }}
+ {{ user.phone }}
+ {{ user.mobile }}
+
+
+
+
+ -
+ BannerID:
+ @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
+ {
+ @: {{ user.spridenId }}
+ }
+ else
+ {
+ @: {{ user.spridenId }}
+ }
+
+ - PIDM: {{ user.pidm }}
+ - EmployeeID: {{ user.employeeId}}
+ - IAMID: {{ user.iamId }}
+ - MothraID: {{ user.mothraId }}
+ - MIVID: {{ user.mivId }}
+
+
From da850a462d5bcb80fd7d7670b7a2874c8e08ce08 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Wed, 17 Apr 2024 08:19:25 -0700
Subject: [PATCH 16/69] Testing
---
web/Areas/Directory/Models/IndividualSearchResult.cs | 3 +--
web/Areas/Directory/Services/VMACSService.cs | 11 ++++++-----
web/Areas/Directory/Views/CardExample.cshtml | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/web/Areas/Directory/Models/IndividualSearchResult.cs b/web/Areas/Directory/Models/IndividualSearchResult.cs
index ae07c5f..1e1bf98 100644
--- a/web/Areas/Directory/Models/IndividualSearchResult.cs
+++ b/web/Areas/Directory/Models/IndividualSearchResult.cs
@@ -112,7 +112,6 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
if (ldapUserContact != null)
{
- originalObject = ldapUserContact.originalObject;
Title = ldapUserContact.title;
Department = ldapUserContact.department;
Phone = ldapUserContact.telephonenumber;
@@ -140,7 +139,7 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
}
}
Task vmsearch = VMACSService.Search(LoginId);
- Nextel = vmsearch.Result;
+ originalObject = vmsearch.Result;
}
}
}
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index f1558d1..3bebe3f 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -60,11 +60,12 @@ public VMACSService() { }
var buffer = Encoding.UTF8.GetBytes(s);
using (var stream = new MemoryStream(buffer))
{
- var serializer = new XmlSerializer(typeof(VMACS_API));
- var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
- if (vmacs_api != null && vmacs_api.Nextel != null){
- return vmacs_api.Nextel[0];
- }
+ return stream.ToString();
+ //var serializer = new XmlSerializer(typeof(VMACS_API));
+ //var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
+ //if (vmacs_api != null && vmacs_api.Nextel != null){
+ // return vmacs_api.Nextel[0];
+ //}
}
return null;
}
diff --git a/web/Areas/Directory/Views/CardExample.cshtml b/web/Areas/Directory/Views/CardExample.cshtml
index bd19a83..37d388a 100644
--- a/web/Areas/Directory/Views/CardExample.cshtml
+++ b/web/Areas/Directory/Views/CardExample.cshtml
@@ -112,7 +112,7 @@
- {{ JSON.stringify(JSON.parse(user.originalObject), null, 2) }}
+ {{ user.originalObject }}
From b9675acea730668ef06e24dd6678f052d64d2997 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Wed, 17 Apr 2024 08:42:54 -0700
Subject: [PATCH 17/69] Testing
---
web/Areas/Directory/Models/IndividualSearchResult.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/web/Areas/Directory/Models/IndividualSearchResult.cs b/web/Areas/Directory/Models/IndividualSearchResult.cs
index 1e1bf98..1623e6c 100644
--- a/web/Areas/Directory/Models/IndividualSearchResult.cs
+++ b/web/Areas/Directory/Models/IndividualSearchResult.cs
@@ -81,6 +81,7 @@ public IndividualSearchResult()
public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserContact)
{
SVM = false;
+ originalObject = "";
if (aaudUser != null) {
MothraId = aaudUser.MothraId;
LoginId = aaudUser.LoginId;
@@ -138,8 +139,8 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
EmailHost = r.Split("@").Last();
}
}
- Task vmsearch = VMACSService.Search(LoginId);
- originalObject = vmsearch.Result;
+ //Task vmsearch = VMACSService.Search(LoginId);
+ //originalObject = vmsearch.Result;
}
}
}
From 7806f03bff18803bc3f6da08e82a9692b9075859 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Wed, 17 Apr 2024 09:00:03 -0700
Subject: [PATCH 18/69] Testing
---
web/Areas/Directory/Models/IndividualSearchResult.cs | 8 +++++---
web/Areas/Directory/Services/VMACSService.cs | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/web/Areas/Directory/Models/IndividualSearchResult.cs b/web/Areas/Directory/Models/IndividualSearchResult.cs
index 1623e6c..6d6f20c 100644
--- a/web/Areas/Directory/Models/IndividualSearchResult.cs
+++ b/web/Areas/Directory/Models/IndividualSearchResult.cs
@@ -110,7 +110,7 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
SVM = true;
Added = aaudUser.Added;
}
-
+ /*
if (ldapUserContact != null)
{
Title = ldapUserContact.title;
@@ -130,6 +130,7 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
Name = ldapUserContact.displayname;
}
}
+
using (var context = new Classes.SQLContext.AAUDContext())
{
var query = $"SELECT * FROM OPENQUERY(UCDMothra,'SELECT (USERPART || ''@'' || HOSTPART) AS USERATHOST FROM MOTHRA.MAILIDS WHERE MOTHRAID = ''{MothraId}'' AND MAILID = ''{MailId}'' AND MAILSTATUS = ''A'' AND MAILTYPE = ''P''')".ToString();
@@ -139,8 +140,9 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
EmailHost = r.Split("@").Last();
}
}
- //Task vmsearch = VMACSService.Search(LoginId);
- //originalObject = vmsearch.Result;
+ Task vmsearch = VMACSService.Search(LoginId);
+ originalObject = vmsearch.Result;
+ */
}
}
}
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index 3bebe3f..fc07fd8 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -53,6 +53,7 @@ public VMACSService() { }
{
string request = $"/trust/query.xml?dbfile=3&index=CampusLoginId&find={loginID}&format=CHRIS4&AUTH=06232005".ToString();
using HttpResponseMessage response = await sharedClient.GetAsync(request);
+ return response.ToString();
if (response.IsSuccessStatusCode == false){
return null;
}
From a814bceae5052d1e8ec1c866918077e347093458 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Wed, 17 Apr 2024 09:37:43 -0700
Subject: [PATCH 19/69] Testing
---
web/Areas/Directory/Controllers/DirectoryController.cs | 10 +++++-----
web/Areas/Directory/Models/IndividualSearchResult.cs | 2 --
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index d7b7347..f1cb7ed 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -30,7 +30,7 @@ public DirectoryController(Classes.SQLContext.RAPSContext context)
///
/// Directory home page
///
- [Route("/[area]/")]
+ [Route("~/[area]/")]
public async Task Index(string? useExample)
{
return await Task.Run(() => !string.IsNullOrEmpty(useExample)
@@ -41,7 +41,7 @@ public async Task Index(string? useExample)
///
/// Directory home page
///
- [Route("/[area]/nav")]
+ [Route("~/[area]/nav")]
public async Task>> Nav()
{
var nav = new List
@@ -57,7 +57,7 @@ public async Task>> Nav()
/// search string
///
[SupportedOSPlatform("windows")]
- [Route("/[area]/search/{search}")]
+ [Route("~/[area]/search/{search}")]
public async Task>> Get(string search)
{
var individuals = await _aaud.AaudUsers
@@ -101,7 +101,7 @@ public async Task>> Get(string
/// search string
///
[SupportedOSPlatform("windows")]
- [Route("/[area]/search/{search}/ucd")]
+ [Route("~/[area]/search/{search}/ucd")]
public async Task>> GetUCD(string search)
{
List results = new();
@@ -144,7 +144,7 @@ public async Task>> GetUCD(stri
///
/// User ID
///
- [Route("/[area]/userInfo/{mothraID}")]
+ [Route("~/[area]/userInfo/{mothraID}")]
public async Task DirectoryResult(string mothraID)
{
// pull in the user based on uid
diff --git a/web/Areas/Directory/Models/IndividualSearchResult.cs b/web/Areas/Directory/Models/IndividualSearchResult.cs
index 6d6f20c..a01c0c8 100644
--- a/web/Areas/Directory/Models/IndividualSearchResult.cs
+++ b/web/Areas/Directory/Models/IndividualSearchResult.cs
@@ -110,7 +110,6 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
SVM = true;
Added = aaudUser.Added;
}
- /*
if (ldapUserContact != null)
{
Title = ldapUserContact.title;
@@ -142,7 +141,6 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
}
Task vmsearch = VMACSService.Search(LoginId);
originalObject = vmsearch.Result;
- */
}
}
}
From def129db335f9afeb0ded7bcec32f44b4d6059a7 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Wed, 17 Apr 2024 09:47:54 -0700
Subject: [PATCH 20/69] Fixes routing
---
web/Areas/Directory/Controllers/DirectoryController.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index f1cb7ed..1e0b119 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -30,7 +30,7 @@ public DirectoryController(Classes.SQLContext.RAPSContext context)
///
/// Directory home page
///
- [Route("~/[area]/")]
+ [Route("[area]/")]
public async Task Index(string? useExample)
{
return await Task.Run(() => !string.IsNullOrEmpty(useExample)
@@ -41,7 +41,7 @@ public async Task Index(string? useExample)
///
/// Directory home page
///
- [Route("~/[area]/nav")]
+ [Route("[area]/nav")]
public async Task>> Nav()
{
var nav = new List
@@ -57,7 +57,7 @@ public async Task>> Nav()
/// search string
///
[SupportedOSPlatform("windows")]
- [Route("~/[area]/search/{search}")]
+ [Route("[area]/search/{search}")]
public async Task>> Get(string search)
{
var individuals = await _aaud.AaudUsers
@@ -101,7 +101,7 @@ public async Task>> Get(string
/// search string
///
[SupportedOSPlatform("windows")]
- [Route("~/[area]/search/{search}/ucd")]
+ [Route("[area]/search/{search}/ucd")]
public async Task>> GetUCD(string search)
{
List results = new();
@@ -144,7 +144,7 @@ public async Task>> GetUCD(stri
///
/// User ID
///
- [Route("~/[area]/userInfo/{mothraID}")]
+ [Route("[area]/userInfo/{mothraID}")]
public async Task DirectoryResult(string mothraID)
{
// pull in the user based on uid
From a0acdf6b65efa2652b71531113d67752cd08bd08 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Thu, 18 Apr 2024 08:43:08 -0700
Subject: [PATCH 21/69] Testing
---
web/Areas/Directory/Controllers/DirectoryController.cs | 10 +++++-----
web/Areas/Directory/Views/CardExample.cshtml | 2 +-
web/Areas/Directory/Views/Index.cshtml | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index 1e0b119..d7b7347 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -30,7 +30,7 @@ public DirectoryController(Classes.SQLContext.RAPSContext context)
///
/// Directory home page
///
- [Route("[area]/")]
+ [Route("/[area]/")]
public async Task Index(string? useExample)
{
return await Task.Run(() => !string.IsNullOrEmpty(useExample)
@@ -41,7 +41,7 @@ public async Task Index(string? useExample)
///
/// Directory home page
///
- [Route("[area]/nav")]
+ [Route("/[area]/nav")]
public async Task>> Nav()
{
var nav = new List
@@ -57,7 +57,7 @@ public async Task>> Nav()
/// search string
///
[SupportedOSPlatform("windows")]
- [Route("[area]/search/{search}")]
+ [Route("/[area]/search/{search}")]
public async Task>> Get(string search)
{
var individuals = await _aaud.AaudUsers
@@ -101,7 +101,7 @@ public async Task>> Get(string
/// search string
///
[SupportedOSPlatform("windows")]
- [Route("[area]/search/{search}/ucd")]
+ [Route("/[area]/search/{search}/ucd")]
public async Task>> GetUCD(string search)
{
List results = new();
@@ -144,7 +144,7 @@ public async Task>> GetUCD(stri
///
/// User ID
///
- [Route("[area]/userInfo/{mothraID}")]
+ [Route("/[area]/userInfo/{mothraID}")]
public async Task DirectoryResult(string mothraID)
{
// pull in the user based on uid
diff --git a/web/Areas/Directory/Views/CardExample.cshtml b/web/Areas/Directory/Views/CardExample.cshtml
index 37d388a..9bd503e 100644
--- a/web/Areas/Directory/Views/CardExample.cshtml
+++ b/web/Areas/Directory/Views/CardExample.cshtml
@@ -133,7 +133,7 @@
},
methods: {
findUsers: async function () {
- var urlBase = "/Directory/search/" + this.userSearch
+ var urlBase = "@Url.Content("~/Directory/search/")" + this.userSearch;
if (this.ucd) {
urlBase += "/ucd"
}
diff --git a/web/Areas/Directory/Views/Index.cshtml b/web/Areas/Directory/Views/Index.cshtml
index f939a45..fa68030 100644
--- a/web/Areas/Directory/Views/Index.cshtml
+++ b/web/Areas/Directory/Views/Index.cshtml
@@ -147,8 +147,8 @@
},
methods: {
findUsers: async function () {
- this.users.urlBase = "/Directory/search/" + this.userSearch;
- if (this.ucd) this.users.urlBase = "/Directory/search/" + this.userSearch + "/ucd";
+ this.users.urlBase = "@Url.Content("~/Directory/search/")" + this.userSearch;
+ if (this.ucd) this.users.urlBase = "@Url.Content("~/Directory/search/")" + this.userSearch + "/ucd";
if (this.userSearch.length >= 2) {
this.users.load(this)
}
@@ -157,8 +157,8 @@
mounted() {
this.users.loading = false;
if (this.userSearch.length >= 2) {
- this.users.urlBase = "/Directory/search/" + this.userSearch;
- if (this.ucd) this.users.urlBase = "/Directory/search/" + this.userSearch + "/ucd";
+ this.users.urlBase = "@Url.Content("~/Directory/search/")" + this.userSearch;
+ if (this.ucd) this.users.urlBase = "@Url.Content("~/Directory/search/")" + this.userSearch + "/ucd";
this.users.load(this);
}
},
From efb6e8624a730ceef19c902fe2da860144ea2157 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Thu, 18 Apr 2024 08:56:18 -0700
Subject: [PATCH 22/69] Testing
---
web/Areas/Directory/Controllers/DirectoryController.cs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index d7b7347..7ebd647 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -9,6 +9,7 @@
using Viper.Areas.RAPS.Models;
using Viper.Areas.Directory.Models;
using System.Runtime.Versioning;
+using System.Collections.Generic;
namespace Viper.Areas.Directory.Controllers
{
@@ -60,6 +61,9 @@ public async Task>> Nav()
[Route("/[area]/search/{search}")]
public async Task>> Get(string search)
{
+ List results = new();
+ return results;
+ /*
var individuals = await _aaud.AaudUsers
.Where(u => (u.DisplayFirstName + " " + u.DisplayLastName).Contains(search)
|| (u.MailId != null && u.MailId.Contains(search))
@@ -93,6 +97,7 @@ public async Task>> Get(string
}
});
return results;
+ */
}
///
From 076765c832e10f4790f16bc46f27e8b76e440cf3 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Thu, 18 Apr 2024 09:03:07 -0700
Subject: [PATCH 23/69] Testing
---
web/Areas/Directory/Controllers/DirectoryController.cs | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index 7ebd647..17a40b4 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -61,9 +61,6 @@ public async Task>> Nav()
[Route("/[area]/search/{search}")]
public async Task>> Get(string search)
{
- List results = new();
- return results;
- /*
var individuals = await _aaud.AaudUsers
.Where(u => (u.DisplayFirstName + " " + u.DisplayLastName).Contains(search)
|| (u.MailId != null && u.MailId.Contains(search))
@@ -81,6 +78,7 @@ public async Task>> Get(string
List results = new();
AaudUser? currentUser = UserHelper.GetCurrentUser();
bool hasDetailPermission = UserHelper.HasPermission(_rapsContext, currentUser, "SVMSecure.DirectoryDetail");
+ /*
individuals.ForEach(m =>
{
LdapUserContact? l = new LdapService().GetUserByID(m.IamId);
@@ -96,8 +94,8 @@ public async Task>> Get(string
: new IndividualSearchResult(m, l));
}
});
- return results;
*/
+ return results;
}
///
From 5e667bc6d0b01429212831c0de294a7cddd04178 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Thu, 18 Apr 2024 09:35:57 -0700
Subject: [PATCH 24/69] Testing
---
web/Areas/Directory/Controllers/DirectoryController.cs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index 17a40b4..34fa99d 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -78,11 +78,10 @@ public async Task>> Get(string
List results = new();
AaudUser? currentUser = UserHelper.GetCurrentUser();
bool hasDetailPermission = UserHelper.HasPermission(_rapsContext, currentUser, "SVMSecure.DirectoryDetail");
- /*
individuals.ForEach(m =>
{
LdapUserContact? l = new LdapService().GetUserByID(m.IamId);
-
+ /*
if(false)
{
results.Add(IndividualSearchResultCreator.CreateIndividualSearchResult(currentUser, l, hasDetailPermission));
@@ -93,8 +92,8 @@ public async Task>> Get(string
? new IndividualSearchResultWithIDs(m, l)
: new IndividualSearchResult(m, l));
}
+ */
});
- */
return results;
}
From a988cd62f0502d60a0a01fa8bebb1f15aff73431 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Thu, 18 Apr 2024 12:09:55 -0700
Subject: [PATCH 25/69] Testing
---
web/Areas/Directory/Controllers/DirectoryController.cs | 2 --
web/Areas/RAPS/Services/LdapService.cs | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index 34fa99d..f14485f 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -81,7 +81,6 @@ public async Task>> Get(string
individuals.ForEach(m =>
{
LdapUserContact? l = new LdapService().GetUserByID(m.IamId);
- /*
if(false)
{
results.Add(IndividualSearchResultCreator.CreateIndividualSearchResult(currentUser, l, hasDetailPermission));
@@ -92,7 +91,6 @@ public async Task>> Get(string
? new IndividualSearchResultWithIDs(m, l)
: new IndividualSearchResult(m, l));
}
- */
});
return results;
}
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 82bc7e6..346a2fc 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -224,6 +224,7 @@ public Dictionary GetUsersContactDictionary(string searc
/// LdapUserContact
public LdapUserContact? GetUserByID(string? id)
{
+ return null;
if (id == null) return null;
string filter = string.Format("(|(ucdpersoniamid = {0}))", id);
DirectoryEntry de = GetRootContact();
From 1cc49a9acf23cd3b5ed65756ca411485e8074955 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Thu, 18 Apr 2024 12:25:59 -0700
Subject: [PATCH 26/69] Testing
---
web/Areas/Directory/Services/VMACSService.cs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index fc07fd8..708004e 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -53,7 +53,6 @@ public VMACSService() { }
{
string request = $"/trust/query.xml?dbfile=3&index=CampusLoginId&find={loginID}&format=CHRIS4&AUTH=06232005".ToString();
using HttpResponseMessage response = await sharedClient.GetAsync(request);
- return response.ToString();
if (response.IsSuccessStatusCode == false){
return null;
}
@@ -62,11 +61,11 @@ public VMACSService() { }
using (var stream = new MemoryStream(buffer))
{
return stream.ToString();
- //var serializer = new XmlSerializer(typeof(VMACS_API));
- //var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
- //if (vmacs_api != null && vmacs_api.Nextel != null){
- // return vmacs_api.Nextel[0];
- //}
+ var serializer = new XmlSerializer(typeof(VMACS_API));
+ var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
+ if (vmacs_api != null && vmacs_api.Nextel != null){
+ return vmacs_api.Nextel[0];
+ }
}
return null;
}
From 6645147a4724795596943a47f0fe146d71ce3db2 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Thu, 18 Apr 2024 12:34:31 -0700
Subject: [PATCH 27/69] Testing
---
web/Areas/Directory/Services/VMACSService.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index 708004e..f1558d1 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -60,7 +60,6 @@ public VMACSService() { }
var buffer = Encoding.UTF8.GetBytes(s);
using (var stream = new MemoryStream(buffer))
{
- return stream.ToString();
var serializer = new XmlSerializer(typeof(VMACS_API));
var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
if (vmacs_api != null && vmacs_api.Nextel != null){
From 3a034e9d327a52bdd161452e751b8f2405312c3e Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Fri, 19 Apr 2024 08:11:01 -0700
Subject: [PATCH 28/69] Testing
---
web/Areas/Directory/Services/VMACSService.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index f1558d1..d4dea40 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -62,6 +62,7 @@ public VMACSService() { }
{
var serializer = new XmlSerializer(typeof(VMACS_API));
var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
+ return vmacs_api.ToString();
if (vmacs_api != null && vmacs_api.Nextel != null){
return vmacs_api.Nextel[0];
}
From 47b1d080d517cc72e20736f725d3074184186f26 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Fri, 19 Apr 2024 08:18:26 -0700
Subject: [PATCH 29/69] Testing
---
web/Areas/Directory/Services/VMACSService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index d4dea40..6eb78e3 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -61,8 +61,8 @@ public VMACSService() { }
using (var stream = new MemoryStream(buffer))
{
var serializer = new XmlSerializer(typeof(VMACS_API));
+ return serializer.ToString();
var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
- return vmacs_api.ToString();
if (vmacs_api != null && vmacs_api.Nextel != null){
return vmacs_api.Nextel[0];
}
From 161f4957e1b10f5f850896c08fb53968b5ab0935 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Fri, 19 Apr 2024 08:38:44 -0700
Subject: [PATCH 30/69] Testing
---
web/Areas/Directory/Services/VMACSService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index 6eb78e3..620b79f 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -61,7 +61,7 @@ public VMACSService() { }
using (var stream = new MemoryStream(buffer))
{
var serializer = new XmlSerializer(typeof(VMACS_API));
- return serializer.ToString();
+ return stream.ToString();
var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
if (vmacs_api != null && vmacs_api.Nextel != null){
return vmacs_api.Nextel[0];
From 70bb604ce437331a7c782c68855acdc76cee9c19 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Fri, 19 Apr 2024 08:43:29 -0700
Subject: [PATCH 31/69] Testing
---
web/Areas/Directory/Services/VMACSService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index 620b79f..9d729fa 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -61,7 +61,7 @@ public VMACSService() { }
using (var stream = new MemoryStream(buffer))
{
var serializer = new XmlSerializer(typeof(VMACS_API));
- return stream.ToString();
+ return Encoding.ASCII.GetString(stream.ToArray());
var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
if (vmacs_api != null && vmacs_api.Nextel != null){
return vmacs_api.Nextel[0];
From 1b5d198b91e34053287cc495d44dae7c65925267 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Fri, 19 Apr 2024 09:20:14 -0700
Subject: [PATCH 32/69] Testing
---
web/Areas/Directory/Services/VMACSService.cs | 56 +++++++++++++++++---
1 file changed, 48 insertions(+), 8 deletions(-)
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index 9d729fa..d6de6aa 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -17,13 +17,34 @@ public class VMACSService
BaseAddress = new Uri("https://vmacs-vmth.vetmed.ucdavis.edu"),
};
/*
+
+
+
+ 3
+ VMTH PERSON
+ /trust/query.xml?dbfile=3&index=CampusLoginId&find=bedwards&format=CHRIS4&AUTH=06232005
+ -
+ Brandon Edwards
+ 10172
+ Computer Services
+ 13Oct23
+ 916-893-1205
+ 916-893-1205
+ Staff
+ bedwards
+ bsedwards@ucdavis.edu
+
+
*
*/
- [XmlRoot("query/item")]
- public class VMACS_API
+ [XmlRoot("item")]
+ public class VMACS_item
{
- [XmlElement("name")]
+ [XmlAttribute("dbfile")]
+ public int dbfile { get; set; }
+
+ [XmlElement("Name")]
public string[]? Name { get; set; }
[XmlElement("UserID")]
public string[]? VMACSID { get; set; }
@@ -41,6 +62,24 @@ public class VMACS_API
public string[]? Campus_LoginID { get; set; }
[XmlElement("Email_Forward")]
public string[]? Email_Forward { get; set; }
+ [XmlElement("LastEdit")]
+ public string[]? LastEdit { get; set; }
+ }
+
+ [XmlRoot("query")]
+ public class VMACS_query
+ {
+ [XmlElement("item")]
+ public VMACS_item item { get; set; }
+
+ [XmlElement("dbfile")]
+ public string[]? dbfile { get; set; }
+
+ [XmlElement("dbfileNm")]
+ public string[]? dbfileNm { get; set; }
+
+ [XmlElement("uri")]
+ public string[]? uri { get; set; }
}
public VMACSService() { }
@@ -60,11 +99,12 @@ public VMACSService() { }
var buffer = Encoding.UTF8.GetBytes(s);
using (var stream = new MemoryStream(buffer))
{
- var serializer = new XmlSerializer(typeof(VMACS_API));
- return Encoding.ASCII.GetString(stream.ToArray());
- var vmacs_api = (VMACS_API?)serializer.Deserialize(stream);
- if (vmacs_api != null && vmacs_api.Nextel != null){
- return vmacs_api.Nextel[0];
+ var serializer = new XmlSerializer(typeof(VMACS_query));
+ //return Encoding.ASCII.GetString(stream.ToArray());
+ var vmacs_api = (VMACS_query?)serializer.Deserialize(stream);
+ if (vmacs_api != null && vmacs_api.item != null && vmacs_api.item.Nextel != null)
+ {
+ return vmacs_api.item.Nextel[0];
}
}
return null;
From 3d25beaed117f29576c6c6ffb5bff9e9a88e9b00 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 10:31:20 -0700
Subject: [PATCH 33/69] try/catch around ldap group retrieval
---
web/Areas/RAPS/Services/LdapService.cs | 2 +-
web/Areas/RAPS/Services/OuGroupService.cs | 14 +++++++++++++-
web/Classes/ApiExceptionFilter.cs | 4 ++++
web/Views/Shared/_VIPERLayout.cshtml | 2 +-
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 2f2bf09..ade66e5 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -68,7 +68,7 @@ public List GetGroups(string? name = null)
filter = string.Format("(&{0}(cn=*{1}*))", filter, name);
};
SearchResultCollection results = new DirectorySearcher(GetRoot(true), filter, _groupProperties, SearchScope.Subtree)
- { PageSize = 1000 }
+ { PageSize = 1000, ReferralChasing = ReferralChasingOption.All }
.FindAll();
List groups = new();
foreach(SearchResult result in results)
diff --git a/web/Areas/RAPS/Services/OuGroupService.cs b/web/Areas/RAPS/Services/OuGroupService.cs
index 5ebf40e..50716fc 100644
--- a/web/Areas/RAPS/Services/OuGroupService.cs
+++ b/web/Areas/RAPS/Services/OuGroupService.cs
@@ -1,6 +1,8 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
+using NLog;
using NuGet.Protocol.Plugins;
+using Polly;
using System.Linq.Dynamic.Core;
using System.Runtime.Versioning;
using Viper.Areas.RAPS.Models;
@@ -44,7 +46,17 @@ public async Task> GetAllGroups(string? search)
.ThenInclude(gr => gr.Role)
.ThenInclude(r => r.TblRoleMembers)
.ToListAsync();
- List ldapGroups = _ldapService.GetGroups();
+ List ldapGroups = new();
+ try
+ {
+ _ldapService.GetGroups();
+ }
+ catch (Exception ex)
+ {
+ Logger logger = LogManager.GetCurrentClassLogger();
+ logger.Error(ex);
+ }
+
List managedGroups = await _uInformService.GetManagedGroups();
List groups = new();
diff --git a/web/Classes/ApiExceptionFilter.cs b/web/Classes/ApiExceptionFilter.cs
index 39ba251..f75e926 100644
--- a/web/Classes/ApiExceptionFilter.cs
+++ b/web/Classes/ApiExceptionFilter.cs
@@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
+using NLog;
using System.Net;
+using System.Transactions;
namespace Viper.Classes
{
@@ -16,6 +18,8 @@ public override void OnException(ExceptionContext context)
}
);
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
+ Logger logger = LogManager.GetCurrentClassLogger();
+ logger.Error(context.Exception);
}
private List GetErrorList(ExceptionContext context)
diff --git a/web/Views/Shared/_VIPERLayout.cshtml b/web/Views/Shared/_VIPERLayout.cshtml
index ad9bc98..1291018 100644
--- a/web/Views/Shared/_VIPERLayout.cshtml
+++ b/web/Views/Shared/_VIPERLayout.cshtml
@@ -203,7 +203,7 @@
auto-close="true">
-
+
{{viperErrorMessage}}
From 0e1a8634f85d326d7d85bd889975771c7115b572 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 10:56:53 -0700
Subject: [PATCH 34/69] Adding debugging
---
web/Areas/RAPS/Services/LdapService.cs | 29 +++++++++++++++++++-------
web/nlog.config | 13 +++++++++++-
2 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index ade66e5..0de80cf 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -2,6 +2,7 @@
using System.Runtime.Versioning;
using System.DirectoryServices.AccountManagement;
using Viper.Areas.RAPS.Models;
+using NLog;
namespace Viper.Areas.RAPS.Services
{
@@ -10,6 +11,8 @@ public class LdapService
{
private const string _username = "ou\\svc-accounts";
+ private Logger _logger;
+
//Start OUs for ou.ad3 (old-style groups and service accounts) and ad3 (users and api managed groups)
private const string _ouStart = "OU=SVM,OU=Departments,DC=ou,DC=ad3,DC=ucdavis,DC=edu";
private const string _ad3Users = "OU=ucdUsers,DC=ad3,DC=ucdavis,DC=edu";
@@ -53,7 +56,9 @@ public class LdapService
"memberOf"
};
- public LdapService() { }
+ public LdapService() {
+ _logger = LogManager.GetCurrentClassLogger();
+ }
///
/// Get groups, optionally filtering with a wildcard match to name
@@ -67,15 +72,24 @@ public List GetGroups(string? name = null)
{
filter = string.Format("(&{0}(cn=*{1}*))", filter, name);
};
- SearchResultCollection results = new DirectorySearcher(GetRoot(true), filter, _groupProperties, SearchScope.Subtree)
- { PageSize = 1000, ReferralChasing = ReferralChasingOption.All }
- .FindAll();
+ _logger.Info("LdapService.GetGroups(" + (name ?? "") + ")");
+
List groups = new();
- foreach(SearchResult result in results)
+ try
+ {
+ SearchResultCollection results = new DirectorySearcher(GetRoot(true), filter, _groupProperties, SearchScope.Subtree)
+ { PageSize = 1000, ReferralChasing = ReferralChasingOption.All }
+ .FindAll();
+ foreach (SearchResult result in results)
+ {
+ groups.Add(new LdapGroup(result));
+ }
+ groups.Sort((g1, g2) => g1.DistinguishedName.CompareTo(g2.DistinguishedName));
+ }
+ catch (Exception ex)
{
- groups.Add(new LdapGroup(result));
+ _logger.Error(ex);
}
- groups.Sort((g1, g2) => g1.DistinguishedName.CompareTo(g2.DistinguishedName));
return groups;
}
@@ -243,6 +257,7 @@ private DirectoryEntry GetRoot(bool fromOu = false)
{
string start = fromOu ? _ouStart : _ad3Users;
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
+ _logger.Info("Root LDAP is " + string.Format("LDAP://{0}", start));
return new DirectoryEntry(string.Format("LDAP://{0}", start), _username, creds, AuthenticationTypes.Secure);
}
diff --git a/web/nlog.config b/web/nlog.config
index 8c7d23d..d6e4665 100644
--- a/web/nlog.config
+++ b/web/nlog.config
@@ -21,6 +21,10 @@
+
+
@@ -81,12 +85,19 @@
-
+
+
+
+
+
+
+
+
From 00053bc384a8f0eee6ba4cc9c14b73e1dda4e3aa Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 11:27:50 -0700
Subject: [PATCH 35/69] Logging specific exception
---
web/Areas/RAPS/Services/LdapService.cs | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 0de80cf..de29014 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -75,17 +75,24 @@ public List GetGroups(string? name = null)
_logger.Info("LdapService.GetGroups(" + (name ?? "") + ")");
List groups = new();
+ var de = GetRoot(true);
+ _logger.Info("LDAP DE Server: " + de?.Options?.GetCurrentServerName());
+ var ds = new DirectorySearcher(de, filter, _groupProperties, SearchScope.Subtree)
+ { PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
try
{
- SearchResultCollection results = new DirectorySearcher(GetRoot(true), filter, _groupProperties, SearchScope.Subtree)
- { PageSize = 1000, ReferralChasing = ReferralChasingOption.All }
- .FindAll();
+ SearchResultCollection results = ds.FindAll();
foreach (SearchResult result in results)
{
groups.Add(new LdapGroup(result));
}
groups.Sort((g1, g2) => g1.DistinguishedName.CompareTo(g2.DistinguishedName));
}
+ catch (DirectoryServicesCOMException cex)
+ {
+ _logger.Error(cex);
+ _logger.Error(cex.ExtendedError);
+ }
catch (Exception ex)
{
_logger.Error(ex);
From c36a40c6c816a10e8db453803092390cde94bfa1 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 11:36:15 -0700
Subject: [PATCH 36/69] Moving into try
---
web/Areas/RAPS/Services/LdapService.cs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index de29014..714aed8 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -75,12 +75,13 @@ public List GetGroups(string? name = null)
_logger.Info("LdapService.GetGroups(" + (name ?? "") + ")");
List groups = new();
- var de = GetRoot(true);
- _logger.Info("LDAP DE Server: " + de?.Options?.GetCurrentServerName());
- var ds = new DirectorySearcher(de, filter, _groupProperties, SearchScope.Subtree)
- { PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
try
{
+ var de = GetRoot(true);
+ _logger.Info("LDAP DE Server: " + de?.Options?.GetCurrentServerName());
+ var ds = new DirectorySearcher(de, filter, _groupProperties, SearchScope.Subtree)
+ { PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
+
SearchResultCollection results = ds.FindAll();
foreach (SearchResult result in results)
{
From a5e33be706feb8f5ee09b2452fbba115e1ef4f61 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 12:55:44 -0700
Subject: [PATCH 37/69] Adding message
---
web/Areas/RAPS/Services/LdapService.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 714aed8..402e564 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -80,7 +80,7 @@ public List GetGroups(string? name = null)
var de = GetRoot(true);
_logger.Info("LDAP DE Server: " + de?.Options?.GetCurrentServerName());
var ds = new DirectorySearcher(de, filter, _groupProperties, SearchScope.Subtree)
- { PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
+ { PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
SearchResultCollection results = ds.FindAll();
foreach (SearchResult result in results)
@@ -92,7 +92,7 @@ public List GetGroups(string? name = null)
catch (DirectoryServicesCOMException cex)
{
_logger.Error(cex);
- _logger.Error(cex.ExtendedError);
+ _logger.Error("Extended Error: " + cex?.ExtendedErrorMessage);
}
catch (Exception ex)
{
From d7be9441edd1deda06702e4bfa58c6954a0b2a84 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 13:10:43 -0700
Subject: [PATCH 38/69] Adding server to ldap connection
---
web/Areas/RAPS/Services/LdapService.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 402e564..85223f6 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -16,6 +16,8 @@ public class LdapService
//Start OUs for ou.ad3 (old-style groups and service accounts) and ad3 (users and api managed groups)
private const string _ouStart = "OU=SVM,OU=Departments,DC=ou,DC=ad3,DC=ucdavis,DC=edu";
private const string _ad3Users = "OU=ucdUsers,DC=ad3,DC=ucdavis,DC=edu";
+ private const string _ouServer = "ou.ad3.ucdavis.edu";
+ private const string _ad3Server = "ad3.ucdavis.edu";
//ldap attributes/properties to return for each object type
private readonly string[] _groupProperties =
@@ -264,8 +266,9 @@ private static List SortUsers(List users)
private DirectoryEntry GetRoot(bool fromOu = false)
{
string start = fromOu ? _ouStart : _ad3Users;
+ string server = fromOu ? _ouServer : _ad3Server;
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
- _logger.Info("Root LDAP is " + string.Format("LDAP://{0}", start));
+ _logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
return new DirectoryEntry(string.Format("LDAP://{0}", start), _username, creds, AuthenticationTypes.Secure);
}
From ffd4fe368672e16d227886fc02302a23f746256e Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 13:30:27 -0700
Subject: [PATCH 39/69] capitalizing departments
---
web/Areas/RAPS/Services/LdapService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 85223f6..b5983dd 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -14,7 +14,7 @@ public class LdapService
private Logger _logger;
//Start OUs for ou.ad3 (old-style groups and service accounts) and ad3 (users and api managed groups)
- private const string _ouStart = "OU=SVM,OU=Departments,DC=ou,DC=ad3,DC=ucdavis,DC=edu";
+ private const string _ouStart = "OU=SVM,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=ucdavis,DC=edu";
private const string _ad3Users = "OU=ucdUsers,DC=ad3,DC=ucdavis,DC=edu";
private const string _ouServer = "ou.ad3.ucdavis.edu";
private const string _ad3Server = "ad3.ucdavis.edu";
From 1a412b059345ddd7b77927c241d2f7913ac64358 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 14:01:52 -0700
Subject: [PATCH 40/69] using server, then server and start
---
web/Areas/RAPS/Services/LdapService.cs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index b5983dd..7d85f3e 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -269,7 +269,11 @@ private DirectoryEntry GetRoot(bool fromOu = false)
string server = fromOu ? _ouServer : _ad3Server;
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
_logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
- return new DirectoryEntry(string.Format("LDAP://{0}", start), _username, creds, AuthenticationTypes.Secure);
+ DirectoryEntry de = new DirectoryEntry(server, _username, creds, AuthenticationTypes.Secure)
+ {
+ Path = string.Format("LDAP://{0}/{1}", server, start)
+ };
+ return de;
}
}
From 82ab7f6448a62aaa2967fd5d1996b17448efd7f2 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 14:09:31 -0700
Subject: [PATCH 41/69] Changing username and logging
---
web/Areas/RAPS/Services/LdapService.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 7d85f3e..537dde3 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -9,7 +9,7 @@ namespace Viper.Areas.RAPS.Services
[SupportedOSPlatform("windows")]
public class LdapService
{
- private const string _username = "ou\\svc-accounts";
+ private const string _username = "CN=svc-accounts,OU=Service Accounts,OU=SVM-OU-LocalUsers,OU=SVM,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=ucdavis,DC=edu";
private Logger _logger;
@@ -268,7 +268,9 @@ private DirectoryEntry GetRoot(bool fromOu = false)
string start = fromOu ? _ouStart : _ad3Users;
string server = fromOu ? _ouServer : _ad3Server;
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
+ _logger.Info("Server is " + server);
_logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
+ _logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no");
DirectoryEntry de = new DirectoryEntry(server, _username, creds, AuthenticationTypes.Secure)
{
Path = string.Format("LDAP://{0}/{1}", server, start)
From d520b0a2796ad6cb76e216f56577c4577bc0d153 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 14:13:08 -0700
Subject: [PATCH 42/69] Paren
---
web/Areas/RAPS/Services/LdapService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 537dde3..fa9c3a5 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -270,7 +270,7 @@ private DirectoryEntry GetRoot(bool fromOu = false)
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
_logger.Info("Server is " + server);
_logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
- _logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no");
+ _logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no"));
DirectoryEntry de = new DirectoryEntry(server, _username, creds, AuthenticationTypes.Secure)
{
Path = string.Format("LDAP://{0}/{1}", server, start)
From 260bb7d959911feaeeb286e26eb5812d106bea7d Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 14:29:54 -0700
Subject: [PATCH 43/69] Updating connection params
---
web/Areas/RAPS/Services/LdapService.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index fa9c3a5..9398be4 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -9,7 +9,7 @@ namespace Viper.Areas.RAPS.Services
[SupportedOSPlatform("windows")]
public class LdapService
{
- private const string _username = "CN=svc-accounts,OU=Service Accounts,OU=SVM-OU-LocalUsers,OU=SVM,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=ucdavis,DC=edu";
+ private const string _username = "ou\\svc-accounts";
private Logger _logger;
@@ -271,9 +271,10 @@ private DirectoryEntry GetRoot(bool fromOu = false)
_logger.Info("Server is " + server);
_logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
_logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no"));
- DirectoryEntry de = new DirectoryEntry(server, _username, creds, AuthenticationTypes.Secure)
+ DirectoryEntry de = new DirectoryEntry(_ad3Server, _username, creds, AuthenticationTypes.Secure)
{
- Path = string.Format("LDAP://{0}/{1}", server, start)
+ //Path = string.Format("LDAP://{0}/{1}", server, start)
+ Path = string.Format("LDAP://{0}", start)
};
return de;
}
From 86070c2fb52353a4fba0730f1e64417baa4dab1b Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 14:38:38 -0700
Subject: [PATCH 44/69] hardcoding a dc
---
web/Areas/RAPS/Services/LdapService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 9398be4..20c6854 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -271,7 +271,7 @@ private DirectoryEntry GetRoot(bool fromOu = false)
_logger.Info("Server is " + server);
_logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
_logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no"));
- DirectoryEntry de = new DirectoryEntry(_ad3Server, _username, creds, AuthenticationTypes.Secure)
+ DirectoryEntry de = new DirectoryEntry("addc12c.ad3.ucdavis.edu", _username, creds, AuthenticationTypes.Secure)
{
//Path = string.Format("LDAP://{0}/{1}", server, start)
Path = string.Format("LDAP://{0}", start)
From 91c8a19adcfbb24e9f65a75e1edddaddb096d3f1 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 14:51:57 -0700
Subject: [PATCH 45/69] Enabling referrer chsing in the DE
---
web/Areas/RAPS/Services/LdapService.cs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 20c6854..41aeb61 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -271,10 +271,14 @@ private DirectoryEntry GetRoot(bool fromOu = false)
_logger.Info("Server is " + server);
_logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
_logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no"));
- DirectoryEntry de = new DirectoryEntry("addc12c.ad3.ucdavis.edu", _username, creds, AuthenticationTypes.Secure)
+ DirectoryEntry de = new DirectoryEntry(server, _username, creds, AuthenticationTypes.Secure)
{
//Path = string.Format("LDAP://{0}/{1}", server, start)
- Path = string.Format("LDAP://{0}", start)
+ Path = string.Format("LDAP://{0}", start),
+ Options =
+ {
+ Referral = ReferralChasingOption.All
+ }
};
return de;
}
From 6b936ae7f0347e0927de7e76d4db4064a1216013 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 15:02:33 -0700
Subject: [PATCH 46/69] Updating path again
---
web/Areas/RAPS/Services/LdapService.cs | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 41aeb61..4637500 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -80,9 +80,9 @@ public List GetGroups(string? name = null)
try
{
var de = GetRoot(true);
- _logger.Info("LDAP DE Server: " + de?.Options?.GetCurrentServerName());
+ //_logger.Info("LDAP DE Server: " + de?.Options?.GetCurrentServerName());
var ds = new DirectorySearcher(de, filter, _groupProperties, SearchScope.Subtree)
- { PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
+ { ReferralChasing = ReferralChasingOption.All };
SearchResultCollection results = ds.FindAll();
foreach (SearchResult result in results)
@@ -273,8 +273,7 @@ private DirectoryEntry GetRoot(bool fromOu = false)
_logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no"));
DirectoryEntry de = new DirectoryEntry(server, _username, creds, AuthenticationTypes.Secure)
{
- //Path = string.Format("LDAP://{0}/{1}", server, start)
- Path = string.Format("LDAP://{0}", start),
+ Path = string.Format("LDAP://{0}/{1}", server, start),
Options =
{
Referral = ReferralChasingOption.All
From a55e460f49b760e14495b0b9ab2ca19999116fda Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 15:11:39 -0700
Subject: [PATCH 47/69] Updating server connection
---
web/Areas/RAPS/Services/LdapService.cs | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 4637500..c622d0f 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -80,9 +80,8 @@ public List GetGroups(string? name = null)
try
{
var de = GetRoot(true);
- //_logger.Info("LDAP DE Server: " + de?.Options?.GetCurrentServerName());
var ds = new DirectorySearcher(de, filter, _groupProperties, SearchScope.Subtree)
- { ReferralChasing = ReferralChasingOption.All };
+ { PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
SearchResultCollection results = ds.FindAll();
foreach (SearchResult result in results)
@@ -271,13 +270,9 @@ private DirectoryEntry GetRoot(bool fromOu = false)
_logger.Info("Server is " + server);
_logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
_logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no"));
- DirectoryEntry de = new DirectoryEntry(server, _username, creds, AuthenticationTypes.Secure)
+ DirectoryEntry de = new DirectoryEntry(string.Format("LDAP://{0}/{1}", server, start), _username, creds, AuthenticationTypes.Secure)
{
- Path = string.Format("LDAP://{0}/{1}", server, start),
- Options =
- {
- Referral = ReferralChasingOption.All
- }
+ Path = string.Format("LDAP://{0}/{1}", server, start)
};
return de;
}
From a77d3da987c66593beddf6ce4b30cc6e6991b8ef Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 15:20:38 -0700
Subject: [PATCH 48/69] Changing location or referral chasing option
---
web/Areas/RAPS/Services/LdapService.cs | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index c622d0f..a9c5516 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -74,12 +74,15 @@ public List GetGroups(string? name = null)
{
filter = string.Format("(&{0}(cn=*{1}*))", filter, name);
};
- _logger.Info("LdapService.GetGroups(" + (name ?? "") + ")");
List groups = new();
try
{
var de = GetRoot(true);
+ if(de.Options != null)
+ {
+ de.Options.Referral = ReferralChasingOption.All;
+ }
var ds = new DirectorySearcher(de, filter, _groupProperties, SearchScope.Subtree)
{ PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
@@ -265,15 +268,9 @@ private static List SortUsers(List users)
private DirectoryEntry GetRoot(bool fromOu = false)
{
string start = fromOu ? _ouStart : _ad3Users;
- string server = fromOu ? _ouServer : _ad3Server;
+ //string server = fromOu ? _ouServer : _ad3Server;
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
- _logger.Info("Server is " + server);
- _logger.Info("Root LDAP is " + string.Format("LDAP://{0}/{1}", server, start));
- _logger.Info("Username: " + _username + " c: " + (creds.Length > 0 ? "yes" : "no"));
- DirectoryEntry de = new DirectoryEntry(string.Format("LDAP://{0}/{1}", server, start), _username, creds, AuthenticationTypes.Secure)
- {
- Path = string.Format("LDAP://{0}/{1}", server, start)
- };
+ DirectoryEntry de = new DirectoryEntry(string.Format("LDAP://{0}", start), _username, creds, AuthenticationTypes.Secure);
return de;
}
From bb7be02358a7fc5b6971e8bec114795375b1fa9f Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 16:01:11 -0700
Subject: [PATCH 49/69] Adding logging
---
web/Areas/RAPS/Services/LdapService.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index a9c5516..80d0359 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -79,12 +79,13 @@ public List GetGroups(string? name = null)
try
{
var de = GetRoot(true);
- if(de.Options != null)
+ if (de.Options != null)
{
+ _logger.Info("Setting DE Referral");
de.Options.Referral = ReferralChasingOption.All;
- }
+ }
var ds = new DirectorySearcher(de, filter, _groupProperties, SearchScope.Subtree)
- { PageSize = 1000, ReferralChasing = ReferralChasingOption.All };
+ { ReferralChasing = ReferralChasingOption.All };
SearchResultCollection results = ds.FindAll();
foreach (SearchResult result in results)
From eccb2ed40fe23e8369e721f83c55b282740f6fbb Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 16:07:41 -0700
Subject: [PATCH 50/69] Using SSL
---
web/Areas/RAPS/Services/LdapService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 80d0359..4334549 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -271,7 +271,7 @@ private DirectoryEntry GetRoot(bool fromOu = false)
string start = fromOu ? _ouStart : _ad3Users;
//string server = fromOu ? _ouServer : _ad3Server;
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
- DirectoryEntry de = new DirectoryEntry(string.Format("LDAP://{0}", start), _username, creds, AuthenticationTypes.Secure);
+ DirectoryEntry de = new DirectoryEntry(string.Format("LDAP://{0}", start), _username, creds, AuthenticationTypes.SecureSocketsLayer);
return de;
}
From 9ca16358c7ee3bdd6212348af41b1f74646dc545 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Mon, 22 Apr 2024 16:22:01 -0700
Subject: [PATCH 51/69] hardcoding ou dc
---
web/Areas/RAPS/Services/LdapService.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 4334549..e7a4545 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -271,7 +271,10 @@ private DirectoryEntry GetRoot(bool fromOu = false)
string start = fromOu ? _ouStart : _ad3Users;
//string server = fromOu ? _ouServer : _ad3Server;
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
- DirectoryEntry de = new DirectoryEntry(string.Format("LDAP://{0}", start), _username, creds, AuthenticationTypes.SecureSocketsLayer);
+ DirectoryEntry de = new DirectoryEntry("oudc12c.ou.ad3.ucdavis.edu", _username, creds, AuthenticationTypes.Secure)
+ {
+ Path = string.Format("LDAP://{0}", start)
+ };
return de;
}
From cd7b88d31ce885283be0a498958b575aaac31ec4 Mon Sep 17 00:00:00 2001
From: Jason Francis <134454748+JasonRobertFrancis@users.noreply.github.com>
Date: Tue, 23 Apr 2024 08:20:12 -0700
Subject: [PATCH 52/69] Adds VMACS API lookup
---
.../Controllers/DirectoryController.cs | 35 ++++-----
.../Models/IndividualSearchResult.cs | 33 +--------
web/Areas/Directory/Models/VMACSItem.cs | 51 +++++++++++++
web/Areas/Directory/Services/VMACSService.cs | 74 ++-----------------
.../Views/{CardExample.cshtml => Card.cshtml} | 71 +++++++++---------
.../Views/{Index.cshtml => Table.cshtml} | 0
web/Areas/RAPS/Services/LdapService.cs | 1 -
7 files changed, 108 insertions(+), 157 deletions(-)
create mode 100644 web/Areas/Directory/Models/VMACSItem.cs
rename web/Areas/Directory/Views/{CardExample.cshtml => Card.cshtml} (70%)
rename web/Areas/Directory/Views/{Index.cshtml => Table.cshtml} (100%)
diff --git a/web/Areas/Directory/Controllers/DirectoryController.cs b/web/Areas/Directory/Controllers/DirectoryController.cs
index f14485f..c151081 100644
--- a/web/Areas/Directory/Controllers/DirectoryController.cs
+++ b/web/Areas/Directory/Controllers/DirectoryController.cs
@@ -10,6 +10,7 @@
using Viper.Areas.Directory.Models;
using System.Runtime.Versioning;
using System.Collections.Generic;
+using Viper.Areas.Directory.Services;
namespace Viper.Areas.Directory.Controllers
{
@@ -34,9 +35,7 @@ public DirectoryController(Classes.SQLContext.RAPSContext context)
[Route("/[area]/")]
public async Task Index(string? useExample)
{
- return await Task.Run(() => !string.IsNullOrEmpty(useExample)
- ? View("~/Areas/Directory/Views/CardExample.cshtml")
- : View("~/Areas/Directory/Views/Index.cshtml"));
+ return await Task.Run(() => View("~/Areas/Directory/Views/Card.cshtml"));
}
///
@@ -81,15 +80,16 @@ public async Task>> Get(string
individuals.ForEach(m =>
{
LdapUserContact? l = new LdapService().GetUserByID(m.IamId);
- if(false)
- {
- results.Add(IndividualSearchResultCreator.CreateIndividualSearchResult(currentUser, l, hasDetailPermission));
- }
- else
+ results.Add(hasDetailPermission
+ ? new IndividualSearchResultWithIDs(m, l)
+ : new IndividualSearchResult(m, l));
+
+ 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.Add(hasDetailPermission
- ? new IndividualSearchResultWithIDs(m, l)
- : new IndividualSearchResult(m, l));
+ results.Last().Nextel = vm.item.Nextel[0];
+ results.Last().LDPager = vm.item.LDPager[0];
}
});
return results;
@@ -125,16 +125,9 @@ public async Task>> GetUCD(stri
foreach (var l in ldap)
{
AaudUser? userInfo = individuals.Find(m => m.IamId == l.ucdpersoniamid);
- if (false)
- {
- results.Add(IndividualSearchResultCreator.CreateIndividualSearchResult(userInfo, l, hasDetailPermission));
- }
- else
- {
- results.Add(hasDetailPermission
- ? new IndividualSearchResultWithIDs(userInfo, l)
- : new IndividualSearchResult(userInfo, l));
- }
+ results.Add(hasDetailPermission
+ ? new IndividualSearchResultWithIDs(userInfo, l)
+ : new IndividualSearchResult(userInfo, l));
};
return results;
}
diff --git a/web/Areas/Directory/Models/IndividualSearchResult.cs b/web/Areas/Directory/Models/IndividualSearchResult.cs
index a01c0c8..694e5d2 100644
--- a/web/Areas/Directory/Models/IndividualSearchResult.cs
+++ b/web/Areas/Directory/Models/IndividualSearchResult.cs
@@ -10,61 +10,38 @@ namespace Viper.Areas.Directory.Models
public class IndividualSearchResult
{
public string ClientId { get; set; } = string.Empty;
-
public string MothraId { get; set; } = string.Empty;
public string UCDPersonUUID { get; set; } = string.Empty;
-
public string? LoginId { 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;
-
public string FirstName { get; set; } = string.Empty;
-
public string? MiddleName { get; set; } = string.Empty;
-
public string DisplayLastName { get; set; } = string.Empty;
-
public string DisplayFirstName { get; set; } = string.Empty;
-
public string? DisplayMiddleName { get; set; } = string.Empty;
-
public string DisplayFullName { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public bool CurrentStudent { get; set; } = false;
-
public bool FutureStudent { get; set; } = false;
-
public bool CurrentEmployee { get; set; } = false;
-
public bool FutureEmployee { get; set; } = false;
-
public int? StudentTerm { get; set; } = null!;
-
public int? EmployeeTerm { get; set; } = null!;
-
public string? PpsId { get; set; } = string.Empty;
-
public string? StudentPKey { get; set; } = string.Empty;
-
public string? EmployeePKey { get; set; } = string.Empty;
public string? Title { get; set; } = string.Empty;
public string? Department { get; set; } = string.Empty;
-
public int Current { get; set; } = -1;
-
public int Future { get; set; } = -1;
-
public string? IamId { get; set; } = string.Empty;
-
public bool? Ross { get; set; } = null!;
-
public DateTime? Added { get; set; } = null!;
-
public string? Phone { get; set; } = null!;
public string? Nextel { get; set; } = null!;
+ public string? LDPager { get; set; } = null!;
public string? Mobile { get; set; } = null!;
public string? PostalAddress { get; set; } = null!;
public string? UCDAffiliation { get; set; } = null!;
@@ -72,10 +49,7 @@ public class IndividualSearchResult
public bool? SVM { get; set; } = null!;
public string? originalObject { get; set; } = null!;
- public IndividualSearchResult()
- {
-
- }
+ public IndividualSearchResult() { }
[SupportedOSPlatform("windows")]
public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserContact)
@@ -109,6 +83,7 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
Ross = aaudUser.Ross;
SVM = true;
Added = aaudUser.Added;
+ UserName = aaudUser.LoginId;
}
if (ldapUserContact != null)
{
@@ -139,8 +114,6 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
EmailHost = r.Split("@").Last();
}
}
- Task vmsearch = VMACSService.Search(LoginId);
- originalObject = vmsearch.Result;
}
}
}
diff --git a/web/Areas/Directory/Models/VMACSItem.cs b/web/Areas/Directory/Models/VMACSItem.cs
new file mode 100644
index 0000000..30f5649
--- /dev/null
+++ b/web/Areas/Directory/Models/VMACSItem.cs
@@ -0,0 +1,51 @@
+using System.Text;
+using System.Xml.Serialization;
+using Viper.Areas.RAPS.Models;
+using Viper.Models.AAUD;
+
+namespace Viper.Areas.Directory.Models
+{
+ [XmlRoot("item")]
+ public class VMACSItem
+ {
+ [XmlAttribute("dbfile")]
+ public int dbfile { get; set; }
+
+ [XmlElement("Name")]
+ public string[]? Name { get; set; }
+ [XmlElement("UserID")]
+ public string[]? VMACSID { get; set; }
+ [XmlElement("Unit")]
+ public string[]? Unit { get; set; }
+ [XmlElement("Home")]
+ public string[]? Home { get; set; }
+ [XmlElement("Nextel")]
+ public string[]? Nextel { get; set; }
+ [XmlElement("LDPager")]
+ public string[]? LDPager { get; set; }
+ [XmlElement("Status")]
+ public string[]? Status { get; set; }
+ [XmlElement("Campus_LoginID")]
+ public string[]? Campus_LoginID { get; set; }
+ [XmlElement("Email_Forward")]
+ public string[]? Email_Forward { get; set; }
+ [XmlElement("LastEdit")]
+ public string[]? LastEdit { get; set; }
+ }
+
+ [XmlRoot("query")]
+ public class VMACSQuery
+ {
+ [XmlElement("item")]
+ public VMACSItem? item { get; set; }
+
+ [XmlElement("dbfile")]
+ public string[]? dbfile { get; set; }
+
+ [XmlElement("dbfileNm")]
+ public string[]? dbfileNm { get; set; }
+
+ [XmlElement("uri")]
+ public string[]? uri { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs
index d6de6aa..9cd2a8f 100644
--- a/web/Areas/Directory/Services/VMACSService.cs
+++ b/web/Areas/Directory/Services/VMACSService.cs
@@ -2,6 +2,7 @@
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices;
using Viper.Areas.RAPS.Models;
+using Viper.Areas.Directory.Models;
using System.Net.Http;
using System.Text;
using System.Xml.Serialization;
@@ -16,71 +17,6 @@ public class VMACSService
{
BaseAddress = new Uri("https://vmacs-vmth.vetmed.ucdavis.edu"),
};
- /*
-
-
-
- 3
- VMTH PERSON
- /trust/query.xml?dbfile=3&index=CampusLoginId&find=bedwards&format=CHRIS4&AUTH=06232005
- -
- Brandon Edwards
- 10172
- Computer Services
- 13Oct23
- 916-893-1205
- 916-893-1205
- Staff
- bedwards
- bsedwards@ucdavis.edu
-
-
-
- *
- */
- [XmlRoot("item")]
- public class VMACS_item
- {
- [XmlAttribute("dbfile")]
- public int dbfile { get; set; }
-
- [XmlElement("Name")]
- public string[]? Name { get; set; }
- [XmlElement("UserID")]
- public string[]? VMACSID { get; set; }
- [XmlElement("Unit")]
- public string[]? Unit { get; set; }
- [XmlElement("Home")]
- public string[]? Home { get; set; }
- [XmlElement("Nextel")]
- public string[]? Nextel { get; set; }
- [XmlElement("LDPager")]
- public string[]? LDPager { get; set; }
- [XmlElement("Status")]
- public string[]? Status { get; set; }
- [XmlElement("Campus_LoginID")]
- public string[]? Campus_LoginID { get; set; }
- [XmlElement("Email_Forward")]
- public string[]? Email_Forward { get; set; }
- [XmlElement("LastEdit")]
- public string[]? LastEdit { get; set; }
- }
-
- [XmlRoot("query")]
- public class VMACS_query
- {
- [XmlElement("item")]
- public VMACS_item item { get; set; }
-
- [XmlElement("dbfile")]
- public string[]? dbfile { get; set; }
-
- [XmlElement("dbfileNm")]
- public string[]? dbfileNm { get; set; }
-
- [XmlElement("uri")]
- public string[]? uri { get; set; }
- }
public VMACSService() { }
@@ -88,7 +24,7 @@ public VMACSService() { }
///
///
///
- public static async Task Search (String? loginID)
+ public static async Task Search (String? loginID)
{
string request = $"/trust/query.xml?dbfile=3&index=CampusLoginId&find={loginID}&format=CHRIS4&AUTH=06232005".ToString();
using HttpResponseMessage response = await sharedClient.GetAsync(request);
@@ -99,12 +35,12 @@ public VMACSService() { }
var buffer = Encoding.UTF8.GetBytes(s);
using (var stream = new MemoryStream(buffer))
{
- var serializer = new XmlSerializer(typeof(VMACS_query));
+ var serializer = new XmlSerializer(typeof(VMACSQuery));
//return Encoding.ASCII.GetString(stream.ToArray());
- var vmacs_api = (VMACS_query?)serializer.Deserialize(stream);
+ var vmacs_api = (VMACSQuery?)serializer.Deserialize(stream);
if (vmacs_api != null && vmacs_api.item != null && vmacs_api.item.Nextel != null)
{
- return vmacs_api.item.Nextel[0];
+ return vmacs_api;
}
}
return null;
diff --git a/web/Areas/Directory/Views/CardExample.cshtml b/web/Areas/Directory/Views/Card.cshtml
similarity index 70%
rename from web/Areas/Directory/Views/CardExample.cshtml
rename to web/Areas/Directory/Views/Card.cshtml
index 9bd503e..9699d1d 100644
--- a/web/Areas/Directory/Views/CardExample.cshtml
+++ b/web/Areas/Directory/Views/Card.cshtml
@@ -25,17 +25,19 @@
color="blue"
label="Display IDs">
+
-
+
-
-
+
+
@@ -69,45 +71,42 @@
{{ user.postalAddress }}
{{ user.phone }}
{{ user.mobile }}
-
+ {{ user.nextel }}
+
-
- -
- BannerID:
- @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
- {
- @: {{ user.spridenId }}
- }
- else
- {
- @: {{ user.spridenId }}
- }
-
- - PIDM: {{ user.pidm }}
- - EmployeeID: {{ user.employeeId}}
- - IAMID: {{ user.iamId }}
- - MothraID: {{ user.mothraId }}
- - MIVID: {{ user.mivId }}
-
-
-
-
-
- - AAUD Check
- - ID Check
- - MSO/CAO Lookup
- @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.DirectoryUCPathInfo"))
+
+ BannerID:
+ @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
{
- @:
-
- UCPath Info
+ @:
{{ user.spridenId }}
}
- @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.CATS.ServiceDesk"))
+ else
{
- @:
-
- Alt. Photo
+ @: {{ 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
+ }
diff --git a/web/Areas/Directory/Views/Index.cshtml b/web/Areas/Directory/Views/Table.cshtml
similarity index 100%
rename from web/Areas/Directory/Views/Index.cshtml
rename to web/Areas/Directory/Views/Table.cshtml
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 346a2fc..82bc7e6 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -224,7 +224,6 @@ public Dictionary GetUsersContactDictionary(string searc
/// LdapUserContact
public LdapUserContact? GetUserByID(string? id)
{
- return null;
if (id == null) return null;
string filter = string.Format("(|(ucdpersoniamid = {0}))", id);
DirectoryEntry de = GetRootContact();
From d29aa3810104b5e1529e14eccb2499c831c3a108 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Tue, 23 Apr 2024 15:23:01 -0700
Subject: [PATCH 53/69] Testing different start for ldap. Shrinking header
avatar
---
web/Areas/Directory/Views/Card.cshtml | 2 +-
web/Areas/RAPS/Services/LdapService.cs | 7 ++++---
web/wwwroot/css/site.css | 10 ++++++++--
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/web/Areas/Directory/Views/Card.cshtml b/web/Areas/Directory/Views/Card.cshtml
index 9699d1d..99fa220 100644
--- a/web/Areas/Directory/Views/Card.cshtml
+++ b/web/Areas/Directory/Views/Card.cshtml
@@ -33,7 +33,7 @@
-->
-
+
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index bae98e4..3ff4bcb 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -18,7 +18,7 @@ public class LdapService
private Logger _logger;
//Start OUs for ou.ad3 (old-style groups and service accounts) and ad3 (users and api managed groups)
- private const string _ouStart = "OU=SVM,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=ucdavis,DC=edu";
+ private const string _ouStart = "DC=ou,DC=ad3,DC=ucdavis,DC=edu";
private const string _ad3Users = "OU=ucdUsers,DC=ad3,DC=ucdavis,DC=edu";
private const string _ouServer = "ou.ad3.ucdavis.edu";
private const string _ad3Server = "ad3.ucdavis.edu";
@@ -421,10 +421,11 @@ private static List SortUsersContact(List user
//the ucdUsers OU in ad3.ucdavis.edu for campus user accounts
private DirectoryEntry GetRoot(bool fromOu = false)
{
+ _logger.Info("GetRoot(" + (fromOu ? "OU" : "AD3") + ")");
string start = fromOu ? _ouStart : _ad3Users;
- //string server = fromOu ? _ouServer : _ad3Server;
+ string server = fromOu ? _ouServer : _ad3Server;
string creds = HttpHelper.GetSetting("Credentials", "UCDavisLDAP") ?? "";
- DirectoryEntry de = new DirectoryEntry("oudc12c.ou.ad3.ucdavis.edu", _username, creds, AuthenticationTypes.Secure)
+ DirectoryEntry de = new DirectoryEntry(server, _username, creds, AuthenticationTypes.Secure)
{
Path = string.Format("LDAP://{0}", start)
};
diff --git a/web/wwwroot/css/site.css b/web/wwwroot/css/site.css
index fb0e06f..aee8a62 100644
--- a/web/wwwroot/css/site.css
+++ b/web/wwwroot/css/site.css
@@ -235,6 +235,12 @@ body {
margin: .0rem 0rem .5rem 0rem;
}
-.q-avatar {
- height: 111px !important; width: 87px !important;
+div#directoryResults .q-avatar {
+ height: 111px !important;
+ width: 87px !important;
}
+
+header .q-avatar {
+ height: 40px !important;
+ width: 31px !important;
+}
\ No newline at end of file
From 4c9685d9c0f9ef5d51a11dd5f9f81636cc961b85 Mon Sep 17 00:00:00 2001
From: Brandon
Date: Wed, 24 Apr 2024 15:06:35 -0700
Subject: [PATCH 54/69] Testing to see if I can get a different error
---
web/Areas/RAPS/Services/LdapService.cs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/web/Areas/RAPS/Services/LdapService.cs b/web/Areas/RAPS/Services/LdapService.cs
index 3ff4bcb..1ec2e47 100644
--- a/web/Areas/RAPS/Services/LdapService.cs
+++ b/web/Areas/RAPS/Services/LdapService.cs
@@ -425,12 +425,13 @@ private DirectoryEntry GetRoot(bool fromOu = false)
string start = fromOu ? _ouStart : _ad3Users;
string server = fromOu ? _ouServer : _ad3Server;
string creds = HttpHelper.GetSetting