教学点名强化
This commit is contained in:
@@ -21,6 +21,7 @@ public sealed class GradesController(
|
||||
SystemRoles.SuperAdmin + "," +
|
||||
SystemRoles.AcademicAdmin + "," +
|
||||
SystemRoles.CollegeAdmin + "," +
|
||||
SystemRoles.Counselor + "," +
|
||||
SystemRoles.Teacher;
|
||||
|
||||
private const string Reviewers =
|
||||
@@ -587,6 +588,15 @@ public sealed class GradesController(
|
||||
if (scope.Scope == DataScope.All) return source;
|
||||
if (scope.Scope == DataScope.College)
|
||||
return source.Where(x => x.Course!.CollegeId == scope.RestrictedCollegeId);
|
||||
if (scope.IsInRole(SystemRoles.Counselor))
|
||||
{
|
||||
// Counselor sees grades for courses in their managed classes' college
|
||||
var collegeIds = db.AdministrativeClasses
|
||||
.Where(c => c.CounselorUserId == scope.UserId)
|
||||
.Select(c => c.Major!.CollegeId)
|
||||
.Distinct();
|
||||
return source.Where(x => collegeIds.Contains(x.Course!.CollegeId));
|
||||
}
|
||||
if (scope.IsInRole(SystemRoles.Teacher))
|
||||
return source.Where(x =>
|
||||
x.Teachers.Any(item => item.Teacher!.UserId == scope.UserId));
|
||||
|
||||
Reference in New Issue
Block a user