edx-platform
edx-platform copied to clipboard
fix: allow only enrolled users in course forum related roles
Description
The course team management section under Instructor > Membership tab allows users to be added a role even if are not enrolled in the course. This is not the expected behaviour based on the help text displayed in the section.
This PR updates update_forum_role_membership api to check whether user is enrolled before adding them to a role.
Supporting information
Private-ref
: BB-7543
Testing instructions
- Setup master devstack or tutor locally.
- Register two users, one of which should have staff access.
- Using the staff user, enroll to a course.
- Under
Instructor > Membership
tab, go toCourse Team Management
section. - Without the changes in this PR, you will be able to add the other user (who did not enroll in this course) to any role.
- With the changes in this PR, it will raise an error with appropriate msg.
Other information
A point of discussion: Should we revoke user's course related roles when they unroll from a course?
Thanks for the pull request, @navinkarkera! Please note that it may take us up to several weeks or months to complete a review and merge your PR.
Feel free to add as much of the following information to the ticket as you can:
- supporting documentation
- Open edX discussion forum threads
- timeline information ("this must be merged by XX date", and why that is)
- partner information ("this is a course on edx.org")
- any other information that can help Product understand the context for the PR
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.
Please let us know once your PR is ready for our review and all tests are green.
@kaustavb12 As per your suggestion, I am splitting up changes related to course team roles (Admin/staff roles) into a separate PR due to inconsistency in studio and lms interfaces. Now this PR holds only forum roles related change, i.e., only enrolled users can be added to forum roles via instructor dashboard.
Hi @openedx/teaching-and-learning! Would someone be able to review / merge this for us? Thanks!
Hi @navinkarkera! Flagging the new tests per the recent update: https://discuss.openedx.org/t/minor-change-to-edx-platform-check-statuses/11131
Hi @openedx/teaching-and-learning! Friendly ping on this.
Hi @navinkarkera and @gabor-boros! Just flagging that a failing check has popped up.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.
Sandbox destroy request received.