Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TeacherEnrollment's limit section privileges for a course is overwritten when observing a student in the same course but different section #2245

Open
cgravatt opened this issue Aug 15, 2023 · 1 comment · May be fixed by #2246

Comments

@cgravatt
Copy link
Contributor

Summary:

The limit section privileges on a TeacherEnrollment for a course is overwritten when observing a student in the same course but different section. Even when the student's enrollment has limit section privileges.

Steps to reproduce:

  1. Enroll a teacher in a section of course with limit section privileges set to true
  2. Enroll a student in a different section of the same course with limit section privileges set to true
  3. Set up the teacher as an observer of the student (for example the teacher teaches a section of a course but has a son or daughter taking a different section of the same course)
  4. Confirm the teacher can now view all sections

Expected behavior:

The teacher can observer the student and only see their enrolled section

Actual behavior:

Teacher is no longer limited to section and can see all sections.

Additional notes:

@cgravatt
Copy link
Contributor Author

I'm happy to contribute a PR to resolve this, but I'm not sure which direction would be preferred. I can see two possibilities.

Option 1: Update create_linked_enrollment_for(observer) to copy over the limit_section_privileges value so that ObserverEnrollments are created with a limit_section_privileges value that matches the student

Option 2: Update section_visibilities_for on the course model to exclude enrollments of type ObserverEnrollment from consideration.

cgravatt added a commit to cgravatt/canvas-lms that referenced this issue Aug 15, 2023
visibility_limited_to_course_sections? should return true if all of the enrollments have limited_section_privileges ignoring observer enrollments

 closes instructuregh-2245

 Test Plan:
   - Enroll a teacher in a section of course with limit section privileges set to true
   - Enroll a student in a different section of the same course with limit section privileges set to true
   - Set up the teacher as an observer of the student (for example the teacher teaches a section of a course but has a son or daughter taking a different section of the same course)
   Confirm the teacher cannot view all sections and can only see the two sections.
cgravatt added a commit to cgravatt/canvas-lms that referenced this issue Aug 16, 2023
visibility_limited_to_course_sections? should return true if all of the enrollments have limited_section_privileges ignoring observer enrollments

 closes instructuregh-2245

 Test Plan:
   - Enroll a teacher in a section of course with limit section privileges set to true
   - Enroll a student in a different section of the same course with limit section privileges set to true
   - Set up the teacher as an observer of the student (for example the teacher teaches a section of a course but has a son or daughter taking a different section of the same course)
   Confirm the teacher cannot view all sections and can only see the two sections.
cgravatt added a commit to cgravatt/canvas-lms that referenced this issue Aug 16, 2023
When creating observer enrollments, copy the limit_course_section_privilege value over from the student enrollment

 closes instructuregh-2245

 Test Plan:
   - Enroll a teacher in a section of course with limit section privileges set to true
   - Enroll a student in a different section of the same course with limit section privileges set to true
   - Set up the teacher as an observer of the student (for example the teacher teaches a section of a course but has a son or daughter taking a different section of the same course)
   Confirm the teacher cannot view all sections and can only see the two sections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant