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

fix: roles cache organization case-insensitive #53

Open
wants to merge 1 commit into
base: open-release/redwood.nelp
Choose a base branch
from

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
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