Skip to content

Commit 749754c

Browse files
refactor: consider course_id when migrating backward for course-level roles
1 parent 29d4f22 commit 749754c

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

openedx_authz/engine/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,8 @@ def migrate_authz_to_legacy_course_roles(
348348
"role": COURSE_ROLE_EQUIVALENCES[role_external_key],
349349
}
350350

351-
# Here we prioritize course_id over org for scope since course-level scope is more specific
352-
# and also both are not needed to create a valid CourseAccessRole entry
353351
if isinstance(role_assignment.scope, CourseOverviewData):
352+
course_access_role_kwargs["org"] = role_assignment.scope.org
354353
course_access_role_kwargs["course_id"] = scope_external_key
355354
elif isinstance(role_assignment.scope, OrgCourseOverviewGlobData):
356355
course_access_role_kwargs["org"] = role_assignment.scope.org

openedx_authz/tests/test_migrations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ def test_authz_rollback_course_authoring_command(self, mock_rollback):
809809
call_command("authz_rollback_course_authoring", "--course-id-list", self.course_id)
810810

811811
mock_rollback.assert_called_once()
812-
_, kwargs = mock_rollback.call_args
812+
args, kwargs = mock_rollback.call_args
813813

814814
self.assertEqual(kwargs["delete_after_migration"], False)
815815

0 commit comments

Comments
 (0)