Restrict acadadmin course access by role and update Summer course lookups#1933
Merged
vikrantwiz02 merged 2 commits intoJul 19, 2026
Merged
Conversation
…designation - SubmitGradesProfAPI and UploadGradesProfAPI now treat a user as acadadmin only when acting as acadadmin (Role=acadadmin) AND holding the designation - Fixes faculty who also hold acadadmin seeing all courses / bypassing the instructor-ownership check while submitting as faculty
…ookups CourseInstructor stores Odd/Summer under the start year and Even under the end year, but parse_academic_year keys Summer on the end year (to match Student_grades). Add course_instructor_year() helper and use it for every CourseInstructor filter (submit dropdown, upload ownership, download grades, PDF, grade status) so a faculty's Summer courses are found. parse_academic_year and Student_grades storage are left unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates how the year is determined when querying
CourseInstructorrecords, ensuring consistency with howCourseInstructorstores Odd/Summer and Even semesters. A new helper functioncourse_instructor_yearis introduced and used throughout the codebase to prevent mismatches and access errors, especially for instructor-based queries and permission checks.Academic year handling improvements:
course_instructor_yearhelper function to encapsulate the logic for determining the correct year to use when queryingCourseInstructorfor a given academic year and semester type.CourseInstructorin thepostmethod and related permission checks to usecourse_instructor_yearinstead ofworking_year, ensuring instructors are matched to the correct courses and semesters. [1] [2] [3] [4] [5]Role and permission logic:
acadadminrole checks by introducing theacting_as_acadadminvariable, ensuring that admin-specific logic is only applied when the user is actually acting as an academic admin. [1] [2]