instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.42k stars 2.42k forks source link

Group API `only_own_groups` filter bug while using trust accounts #2270

Open marcospri opened 8 months ago

marcospri commented 8 months ago

Summary:

The /api/v1/courses/5269/groups?only_own_groups=1 endpoint doesn't return the groups an user belongs to when using the only_own_groups query parameter when used in a trusted accounts setup.

Steps to reproduce:

  1. Set Up a trust relationship between two accounts, A and B.
  2. Login into A as a student.
  3. Pick on of the courses of B
  4. You'll get redirected to B
  5. Try to use /api/v1/courses/ID/groups?only_own_groups=1 returns [] when the students belongs to groups in the course.

For debugging I tried the following, all as the same student session:

{..."id":XXXX0000000000041,"name":"XXX"...}

I get my identity to double check in the next calls

Listing all users in the course groups

{"id":3305,"name":"Group 1a",...,"users":[...{"id":XXXX0000000000041,"name":"XXXX"...}]

It does include the ID of the current user in one of the groups

Listing the groups I belong to in the same course, it should return the group from the previous call but returns [] instead.

Expected behavior:

The only_own_groups filter should return the groups the user returns in the target account like it does in other scenarios.

Actual behavior:

The only_own_groups filter doesn't return the groups the user belongs to.

dwhly commented 4 months ago

This is a key issue for many CA CC schools within the California Virtual Campus program.