Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cohorts api permissions #34399

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dyudyunov
Copy link
Contributor

@dyudyunov dyudyunov commented Mar 20, 2024

Description

We've discovered a bug while using the Gradebook MFE - users with course staff/instructor roles can create and manage cohorts in the course's Instructor tab BUT they can't use the cohorts filter and the API request returns 403
Screenshot 2024-03-20 at 15 31 07

The issue isn't reproducible for the Global Staff role's users as well as for users with Forum Moderator roles assigned.

Decision

Considering that the course staff/instructor has most of the permissions for the course data manipulation I decided to:

  • Fix lack of the permissions for course staff/instructor roles.
  • Allow course staff/admin users to use cohorts API.

Steps To Reproduce

  • create a course
  • assign any user without Global Staff or Superuser permissions a course staff or course instructor (aka course admin) role
  • navigate to the course's Instructor tab > cohorts > enable and create any number of cohorts for the course. You can use both Global Staff or course staff user.
  • switch to the course staff/instructor user
  • navigate to the course's Instructor tab > Student Admin > click View Gradebook
  • inspect the browser console and try to use the Cohorts filter

Expected Result

Course Staff/Instructor users can use the Cohorts filter on the Gradebook MFE and there is no 403 error for the .../cohorts/ API call in the browser console.
image

Notes

  • The Discussions MFE behavior was not affected.
    Interestingly, only those users who have the Forum Moderator roles assigned can create discussion posts separated by cohorts.
    Even the Global Staff has no such option!
    Anyway, it is out of the scope and I left it as it is.
Screenshot 2024-03-20 at 15 50 55

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Mar 20, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 20, 2024

Thanks for the pull request, @dyudyunov!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/wg-maintenance-edx-platform. Tag them in a comment and let them know that your changes are ready for review.

Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@dyudyunov dyudyunov changed the title fix: cohorts api permissions [WIP] fix: cohorts api permissions Mar 20, 2024
@dyudyunov dyudyunov force-pushed the fix-cohort-api-permissions branch 2 times, most recently from 7f2625d to 630987a Compare March 21, 2024 06:28
@dyudyunov dyudyunov changed the title [WIP] fix: cohorts api permissions fix: cohorts api permissions Mar 21, 2024
@dyudyunov
Copy link
Contributor Author

@mphilbrick211 Hi

This one is ready for review 🙂

@mphilbrick211
Copy link

@mphilbrick211 Hi

This one is ready for review 🙂

Thanks, @dyudyunov! I'm looking into getting a reviewer for this (and the backport).

@dyudyunov
Copy link
Contributor Author

@mphilbrick211 hi

It would be great to have this one reviewed so we could merge it along with the backport to Quince and include the fix in quince.3 release

@mphilbrick211 mphilbrick211 added the needs reviewer assigned PR needs to be (re-)assigned a new reviewer label May 16, 2024
@dyudyunov dyudyunov force-pushed the fix-cohort-api-permissions branch from 630987a to cdb3aeb Compare November 8, 2024 08:22
Fix lack of the permissions for course staff/instructor roles.
Allows course staff/admin users use cohorts API, e.g. for
cohort filters in the Gradebook MFE.
@dyudyunov dyudyunov force-pushed the fix-cohort-api-permissions branch from cdb3aeb to 3036fbe Compare November 26, 2024 08:41
@dyudyunov
Copy link
Contributor Author

@mphilbrick211 hi

Is there anyone able to review this?

@mphilbrick211
Copy link

@dyudyunov apologies for the delay. I've put this out to our Core Contributors for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reviewer assigned PR needs to be (re-)assigned a new reviewer open-source-contribution PR author is not from Axim or 2U
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

3 participants