Skip to content

Commit a56368a

Browse files
committed
feat: implement org retrieval for user roles in authz compatibility layer
1 parent 76fdce3 commit a56368a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

common/djangoapps/student/roles.py

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

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

0 commit comments

Comments
 (0)