feat: implement org retrieval for user roles in authz compatibility layer#38216
feat: implement org retrieval for user roles in authz compatibility layer#38216BryanttV wants to merge 5 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @BryanttV! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
a7c9492 to
2f1ac8a
Compare
2c77464 to
ed65718
Compare
| user_external_key=user.username, | ||
| role_external_key=role, | ||
| ) | ||
| orgs = {assignment.scope.org for assignment in assignments if assignment.scope.org is not None} |
There was a problem hiding this comment.
I have one doubt about the desired functionality for this function.
My first impression was that this function should return the list of org-wide assignations.
However on further inspection, I see that the old code doesn't make a distinction between CourseAccessRoles with or without course_id, and according to the docstring at CourseAccessRole definiton, org-wide assignations are the ones that have course_id as None.
So just to confirm that we are all on the same understanding, this function (legacy version or new one), returns all Orgs to which the user has at least access to one course, right?
There was a problem hiding this comment.
Yes, both _legacy_get_orgs_for_user and _authz_get_orgs_for_user return all orgs where the user has at least one assignment with that role.
ed65718 to
1bfa789
Compare
1bfa789 to
6cfd1b5
Compare
Closes: #38032
Description
This PR adds the functionality for
_authz_get_orgs_for_usermethod in the authz compatibility layer.Related PRs
We need to merge this first:
Testing Instructions
Enable authz for course authoring using the waffle flag (
authz.enable_course_authoring)Go to Studio > Your Course > Settings > Course Team > + New Team Member and add a new member as Staff
Now, check the orgs list:
Deadline
Verawood