Skip to content

Commit

Permalink
Merge branch 's24-privacy-combined-profile' into s24-privacy-combined…
Browse files Browse the repository at this point in the history
…-profile-ferpa
  • Loading branch information
russtuck committed Jul 2, 2024
2 parents 7677b39 + 0e8fcfb commit 6ba3af5
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 203 deletions.
7 changes: 4 additions & 3 deletions Gordon360/Controllers/ProfilesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public class ProfilesController(IProfileService profileService,
return Ok(null);
}

var profile = (CombinedProfileViewModel)profileService.ComposeProfile(student, alumni, faculty, customInfo);
//var profile = profileService.ComposeProfile(student, alumni, faculty, customInfo);
var profile = (CombinedProfileViewModel) profileService.ComposeProfile(student, alumni, faculty, customInfo);

return Ok(profile);
}
Expand Down Expand Up @@ -187,9 +188,9 @@ public PublicFacultyStaffProfileViewModel?

var profile = profileService.ComposeProfile(student, alumni, facstaff, _customInfo);

var cleaned_profile = profileService.ImposePrivacySettings(username, viewerGroups, profile);
var visible_profile = profileService.ImposePrivacySettings(viewerGroups, profile);

return Ok(cleaned_profile);
return Ok(visible_profile);
}

///<summary>Get the advisor(s) of a particular student</summary>
Expand Down
21 changes: 1 addition & 20 deletions Gordon360/Documentation/Gordon360.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Gordon360/Models/ViewModels/AlumniProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public record AlumniProfileViewModel
string HomePostalCode,
string HomeCountry,
string HomePhone,
string HomeFax,
string HomeEmail,
string JobTitle,
string MaritalStatus,
Expand Down Expand Up @@ -69,7 +68,6 @@ public record AlumniProfileViewModel
alu.HomePostalCode ?? "",
alu.HomeCountry ?? "",
alu.HomePhone ?? "",
alu.HomeFax ?? "",
alu.HomeEmail ?? "",
alu.JobTitle ?? "",
alu.MaritalStatus ?? "",
Expand Down
73 changes: 30 additions & 43 deletions Gordon360/Models/ViewModels/CombinedProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,25 @@ public class CombinedProfileViewModel
{
public string ID { get; set; }
public string Title { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string Suffix { get; set; }
public string MaidenName { get; set; }
public string NickName { get; set; }
public ProfileItem FirstName { get; set; }
public ProfileItem MiddleName { get; set; }
public ProfileItem LastName { get; set; }
public ProfileItem Suffix { get; set; }
public ProfileItem MaidenName { get; set; }
public ProfileItem NickName { get; set; }
public string Email { get; set; }
public string Gender { get; set; }
public string HomeStreet1 { get; set; }
public string HomeStreet2 { get; set; }
public string HomeCity { get; set; }
//public ProfileItem HomeCity { get; set; }
public string HomeState { get; set; }
//public ProfileItem HomeState { get; set; }
public string HomePostalCode { get; set; }
public string HomeCountry { get; set; }
//public ProfileItem HomeCountry { get; set; }
//public string HomePhone { get; set; }
public ProfileItem HomeStreet1 { get; set; }
public ProfileItem HomeStreet2 { get; set; }
public ProfileItem HomeCity { get; set; }
public ProfileItem HomeState { get; set; }
public ProfileItem HomePostalCode { get; set; }
public ProfileItem HomeCountry { get; set; }
public ProfileItem HomePhone { get; set; }
public string HomeFax { get; set; }
public string AD_Username { get; set; }
public string AD_Username { get; set; } // Leave as string
public Nullable<int> show_pic { get; set; }
public Nullable<int> preferred_photo { get; set; }
public string Country { get; set; }
//public ProfileItem Country { get; set; }
public ProfileItem Country { get; set; }
public string Barcode { get; set; }
public string Facebook { get; set; }
public string Twitter { get; set; }
Expand Down Expand Up @@ -73,7 +67,7 @@ public class CombinedProfileViewModel

// Alumni Only
public string WebUpdate { get; set; }
public string HomeEmail { get; set; }
public ProfileItem HomeEmail { get; set; }
public string MaritalStatus { get; set; }
public string College { get; set; }
public string ClassYear { get; set; }
Expand Down Expand Up @@ -110,7 +104,7 @@ public class CombinedProfileViewModel
public string KeepPrivate { get; set; }

// ProfileViewModel Only
public string PersonType { get; set; }
public string PersonType { get; set; } // Leave as string

public static implicit operator CombinedProfileViewModel(ProfileViewModel vm)
{
Expand All @@ -119,31 +113,25 @@ public static implicit operator CombinedProfileViewModel(ProfileViewModel vm)
// All Profiles
ID = vm.ID,
Title = vm.Title,
FirstName = vm.FirstName,
MiddleName = vm.MiddleName,
LastName = vm.LastName,
Suffix = vm.Suffix,
MaidenName = vm.MaidenName,
NickName = vm.NickName,
FirstName = vm.FirstName is null || vm.FirstName == "" ? null : new ProfileItem(vm.FirstName, false),
MiddleName = vm.MiddleName is null || vm.MiddleName == "" ? null : new ProfileItem(vm.MiddleName, false),
LastName = vm.LastName is null || vm.LastName == "" ? null : new ProfileItem(vm.LastName, false),
Suffix = vm.Suffix is null || vm.Suffix == "" ? null : new ProfileItem(vm.Suffix, false),
MaidenName = vm.MaidenName is null || vm.MaidenName == "" ? null : new ProfileItem(vm.MaidenName, false),
NickName = vm.NickName is null || vm.NickName == "" ? null : new ProfileItem(vm.NickName, false),
Email = vm.Email,
Gender = vm.Gender,
HomeStreet1 = vm.HomeStreet1,
HomeStreet2 = vm.HomeStreet2,
//HomeCity = vm.HomeCity is null || vm.HomeCity == "" ? null : new ProfileItem(vm.HomeCity, false),
HomeCity = vm.HomeCity,
//HomeState = vm.HomeState is null || vm.HomeState == "" ? null : new ProfileItem(vm.HomeState, false),
HomeState = vm.HomeState,
HomePostalCode = vm.HomePostalCode,
//HomeCountry = vm.HomeCountry is null || vm.HomeCountry == "" ? null : new ProfileItem(vm.HomeCountry, false),
HomeCountry = vm.HomeCountry,
HomeStreet1 = vm.HomeStreet1 is null || vm.HomeStreet1 == "" ? null : new ProfileItem(vm.HomeStreet1, false),
HomeStreet2 = vm.HomeStreet2 is null || vm.HomeStreet2 == "" ? null : new ProfileItem(vm.HomeStreet2, false),
HomeCity = vm.HomeCity is null || vm.HomeCity == "" ? null : new ProfileItem(vm.HomeCity, false),
HomeState = vm.HomeState is null || vm.HomeState == "" ? null : new ProfileItem(vm.HomeState, false),
HomePostalCode = vm.HomePostalCode is null || vm.HomePostalCode == "" ? null : new ProfileItem(vm.HomePostalCode, false),
HomeCountry = vm.HomeCountry is null || vm.HomeCountry == "" ? null : new ProfileItem(vm.HomeCountry, false),
HomePhone = vm.HomePhone is null || vm.HomePhone == "" ? null : new ProfileItem(vm.HomePhone, false),
//HomePhone = vm.HomePhone,
HomeFax = vm.HomeFax,
AD_Username = vm.AD_Username,
show_pic = vm.show_pic,
preferred_photo = vm.preferred_photo,
//Country = vm.Country is null || vm.Country == "" ? null : new ProfileItem(vm.Country, false),
Country = vm.Country,
Country = vm.Country is null || vm.Country == "" ? null : new ProfileItem(vm.Country, false),
Barcode = vm.Barcode,
Facebook = vm.Facebook,
Twitter = vm.Twitter,
Expand Down Expand Up @@ -184,7 +172,7 @@ public static implicit operator CombinedProfileViewModel(ProfileViewModel vm)

// Alumni Only
WebUpdate = vm. WebUpdate,
HomeEmail = vm.HomeEmail,
HomeEmail = vm.HomeEmail is null || vm.HomeEmail == "" ? null : new ProfileItem(vm.HomeEmail, false),
MaritalStatus = vm.MaritalStatus,
College = vm.College,
ClassYear = vm.ClassYear,
Expand All @@ -208,7 +196,6 @@ public static implicit operator CombinedProfileViewModel(ProfileViewModel vm)

// FacStaff and Alumni Only
JobTitle = vm.JobTitle,
// SpouseName = new ProfileItem(vm.SpouseName, false),
SpouseName = vm.SpouseName is null || vm.SpouseName == "" ? null : new ProfileItem(vm.SpouseName, false),

// FacStaff and Student Only
Expand Down
2 changes: 0 additions & 2 deletions Gordon360/Models/ViewModels/FacultyStaffProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public record FacultyStaffProfileViewModel
string HomePostalCode,
string HomeCountry,
string HomePhone,
string HomeFax,
string MobilePhone,
string KeepPrivate,
string JobTitle,
Expand Down Expand Up @@ -73,7 +72,6 @@ public record FacultyStaffProfileViewModel
fac.HomePostalCode ?? "",
fac.HomeCountry ?? "",
fac.HomePhone ?? "",
fac.HomeFax ?? "",
fac.MobilePhone ?? "",
fac.KeepPrivate ?? "",
fac.JobTitle ?? "",
Expand Down
8 changes: 4 additions & 4 deletions Gordon360/Models/ViewModels/PublicAlumniProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public static implicit operator PublicAlumniProfileViewModel(AlumniProfileViewMo
}
else if (!vm.ShareAddress.Contains("Y"))
{
vm.HomeCity = "Private as requested.";
vm.HomeCountry = "";
vm.HomeState = "";
vm.Country = "";
vm.HomeCity = null;
vm.HomeCountry = null;
vm.HomeState = null;
vm.Country = null;
}
return vm;
}
Expand Down
11 changes: 1 addition & 10 deletions Gordon360/Models/ViewModels/PublicStudentProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public static implicit operator PublicStudentProfileViewModel(StudentProfileView
AD_Username = stu.AD_Username ?? "", // Just in case some random record has a null email field
OnOffCampus = stu.OnOffCampus ?? "",
Mail_Location = stu.Mail_Location ?? "",
HomePhone = stu.HomePhone ?? "",
HomeCity = stu.HomeCity ?? "",
HomeState = stu.HomeState ?? "",
HomeCountry = stu.HomeCountry ?? "",
Expand All @@ -77,15 +76,7 @@ public static implicit operator PublicStudentProfileViewModel(StudentProfileView
Minor2Description = stu.Minor2Description ?? "",
Minor3Description = stu.Minor3Description ?? ""
};
if (vm.KeepPrivate.Contains("S"))
{
vm.HomeCity = "Private as requested.";
vm.HomeState = "";
vm.HomeCountry = "";
vm.Country = "";
vm.OnOffCampus = "P";
vm.Hall = "";
}

if (vm.KeepPrivate.Contains("Y") || vm.KeepPrivate.Contains("P"))
{
return null;
Expand Down
2 changes: 0 additions & 2 deletions Gordon360/Models/ViewModels/StudentProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public record StudentProfileViewModel
string HomePostalCode,
string HomeCountry,
string HomePhone,
string HomeFax,
string Cohort,
string Class,
string KeepPrivate,
Expand Down Expand Up @@ -106,7 +105,6 @@ public record StudentProfileViewModel
stu.HomePostalCode ?? "",
stu.HomeCountry ?? "",
stu.HomePhone ?? "",
stu.HomeFax ?? "",
stu.Cohort ?? "",
stu.Class ?? "",
stu.KeepPrivate ?? "",
Expand Down
Loading

0 comments on commit 6ba3af5

Please sign in to comment.