Skip to content

Commit

Permalink
Add CanISeeThisStudent to help enforce FERPA visibility limits
Browse files Browse the repository at this point in the history
  • Loading branch information
russtuck committed Jul 9, 2024
1 parent 549cf8b commit 2e70441
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
34 changes: 32 additions & 2 deletions Gordon360/Controllers/ProfilesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,34 @@ public bool CanISeeStudents()
return false;
}

/// <summary>Indicates whether the user making the request is authorized to see
/// profile information for this particular student. Some students are not shown
/// because of FERPA protections.</summary>
/// <returns>True if the user making the request is authorized to see
/// profile information for this student, and false otherwise.</returns>
public bool CanISeeThisStudent(StudentProfileViewModel? student)
{
if (!CanISeeStudents())
{
return false;
}

var viewerGroups = AuthUtils.GetGroups(User);

if (viewerGroups.Contains(AuthGroup.SiteAdmin) ||
viewerGroups.Contains(AuthGroup.Police) ||
viewerGroups.Contains(AuthGroup.FacStaff))
{
return true;
}
if (viewerGroups.Contains(AuthGroup.Student))
{
//TODO: take "KeepPrivate" into account, to enforce FERPA restrictions
return (student == null) ? false : student.KeepPrivate != "Y";
}
return false;
}

/// <summary>Indicates whether the user making the request is authorized to see
/// profile information for faculty and staff (facstaff).</summary>
/// <returns>True if the user making the request is authorized to see
Expand All @@ -96,7 +124,9 @@ public bool CanISeeAlumni()

/// <summary>Restrict info about a student to those fields which are potentially
/// viewable by the user making the request. Actual visibility may also depend
/// on privacy choices made by the user whose data is being viewed.</summary>
/// on privacy choices made by the user whose data is being viewed. Note that
/// this takes FERPA restrictions into account in determining whether this student
/// is visible to the requesting user.</summary>
/// <returns>Information the requesting user is potentially authorized to see.
/// Null if the requesting user is never allowed to see data about students.</returns>
///
Expand All @@ -110,7 +140,7 @@ public bool CanISeeAlumni()
{
return student;
}
else if (CanISeeStudents())
else if (CanISeeThisStudent(student))
{
return (student == null) ? null : (PublicStudentProfileViewModel)student;
}
Expand Down
11 changes: 10 additions & 1 deletion Gordon360/Documentation/Gordon360.xml

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

0 comments on commit 2e70441

Please sign in to comment.