Skip to content

fix: roles cache organization case-insensitive - #87

Open
andrey-canon wants to merge 1 commit into
open-release/verawood.nelpfrom
and/FUTUREX-1487
Open

fix: roles cache organization case-insensitive#87
andrey-canon wants to merge 1 commit into
open-release/verawood.nelpfrom
and/FUTUREX-1487

Conversation

@andrey-canon

@andrey-canon andrey-canon commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Description

RoleCache compares org in a case-sensitive manner while the value of org is assumed as case-insensitive by the database collation, and by the django admin form. This PR is to fix the issue to make RoleCache behave as the rest of the platform

Testing instructions

Preperation to test:

  • Assume a normal user in the platform, for example test_user
  • Assuming we have two courses in demo organization: course-v1:Demo+topic1+index1 and course-v1:demo+topic2+index2. We have the first course with organization Demo in course-overview instead of demo. This is acceptable in the platform

Before the fix:

  • The admin will not be able to grant test_user an instructor on the entire demo organization, the admin will have to grant it course by course. This is because CourseAccessRole will not allow two similar records like [user: test_user, course_id: "", role: instructor, org: demo] and [user: test_user, course_id: "", role: instructor, org: Demo]. The key constraint treats org as case-insensitive

After the fix:

  • Adding a single record like [user: test_user, course_id: "", role: instructor, org: demo], [user: test_user, course_id: "", role: instructor, org: Demo], or even [user: test_user, course_id: "", role: instructor, org: DEMO] will make test_user an instructor on all courses as expected

Before

image

After

image

Issue # 1487
Migration PR of #66

@andrey-canon
andrey-canon requested a review from johanseto July 31, 2026 18:55
@andrey-canon
andrey-canon changed the base branch from and/FUTUREX-1331 to open-release/verawood.nelp August 4, 2026 16:54
Co-authored-by: shadinaif <shadinaif@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants