diff --git a/Tsi1.Api/Tsi1.Api/Controllers/FileController.cs b/Tsi1.Api/Tsi1.Api/Controllers/FileController.cs index fb7296dfe4acc041f55513ebeb4dd8b42bc18489..bada30e2778ad7a8400aeb5a39fa50dd427b9392 100644 --- a/Tsi1.Api/Tsi1.Api/Controllers/FileController.cs +++ b/Tsi1.Api/Tsi1.Api/Controllers/FileController.cs @@ -21,7 +21,7 @@ namespace Tsi1.Api.Controllers _fileService = fileService; } - [Authorize(Roles = UserTypes.Professor)] + [Authorize(Roles = UserTypes.Professor + ", " + UserTypes.Student + ", " + UserTypes.FacultyAdmin)] [HttpPost("Upload/{courseId}")] public async Task<IActionResult> Upload(IFormFile file, int courseId) { diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Services/CourseService.cs b/Tsi1.Api/Tsi1.BusinessLayer/Services/CourseService.cs index 93cfa7828df1f343bc648bfa2660df590460b5ac..05a0fa9e22757a5fb301336567259a1af62ab6b2 100644 --- a/Tsi1.Api/Tsi1.BusinessLayer/Services/CourseService.cs +++ b/Tsi1.Api/Tsi1.BusinessLayer/Services/CourseService.cs @@ -110,6 +110,8 @@ namespace Tsi1.BusinessLayer.Services var course = await _context.Courses .Include(x => x.Sections) + .ThenInclude(x => x.SectionItems) + .ThenInclude(x => x.SectionItemType) .ThenInclude(x => x.SectionItems) .ThenInclude(x => x.Forum) .FirstOrDefaultAsync(x => x.Id == courseId); @@ -140,6 +142,7 @@ namespace Tsi1.BusinessLayer.Services var automaticSubscriptionForums = course.Sections .SelectMany(x => x.SectionItems) + .Where(x => x.SectionItemType.Name == SectionItemTypes.Forum) .Select(x => x.Forum) .Where(x => x.IsAutomaticSubscription);