edx-enterprise icon indicating copy to clipboard operation
edx-enterprise copied to clipboard

feat: create cea for invite only courses before checkout

Open tecoholic opened this issue 1 year ago • 11 comments

NOTE The PR has been moved to draft to rework the changes.

Description

This allows enterprise learners whose enterprise catalog contains private "invitation only" courses to enroll without having to be explicitly invited.

This adds a new flag to the EnterpriseCustomer models called allow_enrollment_in_invite_only_courses. Once this is enabled, the enrollment POST request will check if the course is "invite-only" and create a CourseEnrollmentAllowed object in the platform if required.

Testing instructions

The following instruction assume you are using the devstack setup for testing.

  1. In a working edx-enterprise setup, add a course which is "invite-only" to the catalog, or change an existing course in the catalog to "Invitation Only". This can be done by going to the "Advanced Settings" in Studio and setting the "Invitation Only" field to true.
  2. Get the enrollment_url of the course - Usually something like this http://localhost:18000/enterprise/<enterprise-id>/course/<course-key>/enroll/?catalog=<catalog-id>&utm_medium=enterprise&utm_source=test-enterprise. This should be obtainable from the enterprise API {{base_url}}/enterprise/api/v1/enterprise_catalogs/{{catalog_id}}/
  3. On the page, try to enroll for the course - this should do the necessary redirects, but show the an error message in the course page. Something like "You need to be enrolled to see this course content".
  4. Checkout the PR branch
  5. Install the PR branch make lms-shell && pip install -e /edx/src/edx-enterprise
  6. Apply the migrations python manage.py lms migrate
  7. Go to the Enterprise Customer admin page
  8. Check the checkbox for Allow Enrollment in Invite Only Courses
  9. Now visit the enrollment URL as a different user and perform enrollment. The enrollment should happen and the learner should have access to the course content.

Merge checklist:

  • [ ] Any new requirements are in the right place (do not manually modify the requirements/*.txt files)
    • base.in if needed in production but edx-platform doesn't install it
    • test-master.in if edx-platform pins it, with a matching version
    • make upgrade && make requirements have been run to regenerate requirements
  • [ ] make static has been run to update webpack bundling if any static content was updated
  • [x] ./manage.py makemigrations has been run
    • Checkout the Database Migration Confluence page for helpful tips on creating migrations.
    • Note: This must be run if you modified any models.
      • It may or may not make a migration depending on exactly what you modified, but it should still be run.
    • This should be run from either a venv with all the lms/edx-enterprise requirements installed or if you checked out edx-enterprise into the src directory used by lms, you can run this command through an lms shell.
      • It would be ./manage.py lms makemigrations in the shell.
  • [ ] Version bumped
  • [ ] Changelog record added
  • [ ] Translations updated (see docs/internationalization.rst but also this isn't blocking for merge atm)

Post merge:

  • [ ] Tag pushed and a new version released
    • Note: Assets will be added automatically. You just need to provide a tag (should match your version number) and title and description.
  • [ ] After versioned build finishes in GitHub Actions, verify version has been pushed to PyPI
    • Each step in the release build has a condition flag that checks if the rest of the steps are done and if so will deploy to PyPi. (so basically once your build finishes, after maybe a minute you should see the new version in PyPi automatically (on refresh))
  • [ ] PR created in edx-platform to upgrade dependencies (including edx-enterprise)
    • This must be done after the version is visible in PyPi as make upgrade in edx-platform will look for the latest version in PyPi.
    • Note: the edx-enterprise constraint in edx-platform must also be bumped to the latest version in PyPi.

Internal Ref

tecoholic avatar Jul 21 '23 13:07 tecoholic

Thanks for the pull request, @tecoholic!

What's next?

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

:radio_button: 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.

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

:radio_button: 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.

:radio_button: Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.

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

Who will review my changes?

This repository is currently unmaintained.

To get help with finding a technical reviewer, tag the community contributions project manager for this PR in a comment and let them know that your changes are ready for review:

  1. On the right-hand side of the PR, find the Contributions project, click the caret in the top right corner to expand it, and check the "Primary PM" field for the name of your PM.
  2. Find their GitHub handle here.

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

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

openedx-webhooks avatar Jul 21 '23 13:07 openedx-webhooks

Hi @tecoholic! Is this ready for review?

mphilbrick211 avatar Aug 02 '23 13:08 mphilbrick211

@mphilbrick211 Yes. It is. However, I am considering creating a issue/proposal collecting a couple of other related PRs and submitted them all together for a someone on the project team to take a look. So, we can take it a bit slow if needed.

tecoholic avatar Aug 02 '23 13:08 tecoholic

@mphilbrick211 Yes. It is. However, I am considering creating a issue/proposal collecting a couple of other related PRs and submitted them all together for a someone on the project team to take a look. So, we can take it a bit slow if needed.

Gotcha. Sounds good. I'll check back in, or just ping me when you're all set!

mphilbrick211 avatar Aug 02 '23 15:08 mphilbrick211

@mphilbrick211 when we have an indication of timing of the review, we need to ask @tecoholic to rebase the branch.

e0d avatar Aug 16 '23 20:08 e0d

Hi @openedx/enterprise-titans! Would someone be able to please review/merge this for us?

CC: @tecoholic

mphilbrick211 avatar Aug 17 '23 19:08 mphilbrick211

Hi @tecoholic! Looks like some branch conflicts have popped up - would you mind having a look?

mphilbrick211 avatar Sep 12 '23 14:09 mphilbrick211

Hi @openedx/enterprise-titans! Just checking in to see if someone is able to review/merge this for us? If so, we'll resolve the branch conflicts to proceed. Thanks!

mphilbrick211 avatar Oct 03 '23 02:10 mphilbrick211

Hi @openedx/enterprise-titans! Just checking in to see if someone is able to review/merge this for us? If so, we'll resolve the branch conflicts to proceed. Thanks!

Checking in on this @openedx/enterprise-titans

mphilbrick211 avatar Oct 24 '23 20:10 mphilbrick211

@openedx/enterprise-titans The PR has been rebased on master and the DB migration updated to the latest version. Kindly review.

cc: @e0d

tecoholic avatar Dec 08 '23 10:12 tecoholic

Hi @openedx/2u-titans! If you're still reviewing pull requests, would you please be able to review / merge this for us? Thanks!

mphilbrick211 avatar Feb 21 '24 14:02 mphilbrick211