Skip to content

fix: roles cache organization case-insensitive#53

Merged
shadinaif merged 1 commit intoopen-release/redwood.nelpfrom
shadinaif/org-roles
Feb 11, 2025
Merged

fix: roles cache organization case-insensitive#53
shadinaif merged 1 commit intoopen-release/redwood.nelpfrom
shadinaif/org-roles

Conversation

@shadinaif
Copy link
Collaborator

@shadinaif shadinaif commented Jan 14, 2025

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

Supporting information

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

Deadline

Other information

  • This is an upstream issue. We'll contribute the fix to upstream once we have a code review here

@shadinaif shadinaif marked this pull request as draft January 14, 2025 07:38
@shadinaif shadinaif force-pushed the shadinaif/org-roles branch from 76c3d5a to 24e266e Compare January 14, 2025 07:46
@shadinaif shadinaif force-pushed the shadinaif/org-roles branch from 24e266e to 4de5d0e Compare January 15, 2025 12:35
@shadinaif shadinaif marked this pull request as ready for review January 15, 2025 13:23
@shadinaif shadinaif merged commit 01e5c84 into open-release/redwood.nelp Feb 11, 2025
77 checks passed
@shadinaif shadinaif deleted the shadinaif/org-roles branch February 11, 2025 14:38
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 this pull request may close these issues.

2 participants