已完善实验管理权限:

校级管理员可查看全部实验项目与成绩单。
学院管理员仅可查看本学院开课,或由本学院教师承担/管理的实验课。
场次取消、参与学生查看也同步执行上述范围校验,避免通过场次 ID 越权。
增加覆盖:校级全量、学院自有课程、跨学院管理课程可见、无关学院课程不可见。
This commit is contained in:
biss committed 2026-08-13 21:16:11 +08:00
1 parent 1e45ede5be
commit 5872c06042
3 files changed
+97 -9

No files matched your search

@@ -1141,8 +1141,13 @@ public sealed class ExperimentGradesController(
var scope = currentUserDataScope.Current;
if (scope.Scope == DataScope.All) return source;
if (scope.Scope == DataScope.College)
{
if (!scope.CollegeId.HasValue) return source.Where(_ => false);
var collegeId = scope.CollegeId.Value;
return source.Where(x =>
x.Course!.CollegeId == scope.RestrictedCollegeId);
x.Course!.CollegeId == collegeId ||
x.Teachers.Any(item => item.Teacher!.CollegeId == collegeId));
}
if (scope.IsInRole(SystemRoles.Teacher))
return source.Where(x => x.Teachers.Any(item =>
item.Teacher!.UserId == scope.UserId));