Skip to content

Commit a7c9492

Browse files
committed
feat: implement org retrieval for user roles in authz compatibility layer
1 parent ae87974 commit a7c9492

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

common/djangoapps/student/roles.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,10 @@ def _authz_get_orgs_for_user(self, user) -> list[str]:
532532
Returns a list of org short names for the user with given role.
533533
AuthZ compatibility layer
534534
"""
535-
# TODO: This will be implemented on Milestone 1
536-
# of the Authz for Course Authoring project
537-
return []
535+
role = get_authz_role_from_legacy_role(self._role_name)
536+
assignments = authz_api.get_user_role_assignments_for_role(user.username, role)
537+
orgs = {assignment.scope.org for assignment in assignments if assignment.scope.org is not None}
538+
return list(orgs)
538539

539540
def _legacy_get_orgs_for_user(self, user) -> list[str]:
540541
"""

0 commit comments

Comments
 (0)