33using System . Threading . Tasks ;
44using HwProj . CoursesService . Client ;
55using HwProj . Models . ContentService . DTO ;
6+ using HwProj . Models . CourseUnitType ;
67using HwProj . SolutionsService . Client ;
78
89namespace HwProj . APIGateway . API . Filters ;
@@ -20,10 +21,10 @@ public FilesPrivacyFilter(ICoursesServiceClient coursesServiceClient, ISolutions
2021
2122 public async Task < bool > CheckDownloadRights ( string ? userId , ScopeDTO fileScope )
2223 {
23- if ( fileScope . CourseUnitType == " Homework" ) return true ;
24- if ( fileScope . CourseUnitType == " Solution" )
24+ if ( fileScope . CourseUnitType == CourseUnitType . Homework ) return true ;
25+ if ( fileScope . CourseUnitType == CourseUnitType . Solution )
2526 {
26- if ( userId == null ) return false ;
27+ if ( userId == null ) return false ;
2728 var studentIds = new HashSet < string > ( ) ;
2829 var solution = await _solutionsServiceClient . GetSolutionById ( fileScope . CourseUnitId ) ;
2930 studentIds . Add ( solution . StudentId ) ;
@@ -40,17 +41,17 @@ public async Task<bool> CheckDownloadRights(string? userId, ScopeDTO fileScope)
4041
4142 return false ;
4243 }
43-
44+
4445 public async Task < bool > CheckUploadRights ( string ? userId , ScopeDTO fileScope )
4546 {
46- if ( userId == null ) return false ;
47- if ( fileScope . CourseUnitType == " Homework" )
47+ if ( userId == null ) return false ;
48+ if ( fileScope . CourseUnitType == CourseUnitType . Homework )
4849 {
4950 var mentorIds = await _coursesServiceClient . GetCourseLecturersIds ( fileScope . CourseId ) ;
5051 if ( ! mentorIds . Contains ( userId ) ) return false ;
5152 return true ;
52- }
53- if ( fileScope . CourseUnitType == " Solution" )
53+ }
54+ if ( fileScope . CourseUnitType == CourseUnitType . Solution )
5455 {
5556 var studentIds = new HashSet < string > ( ) ;
5657 var solution = await _solutionsServiceClient . GetSolutionById ( fileScope . CourseUnitId ) ;
0 commit comments