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

(FFI-3/DS-300) filter user's course enrollment by microsite request #156

Merged
merged 3 commits into from
Nov 22, 2022

Conversation

JuanDavidBuitrago
Copy link
Member

@JuanDavidBuitrago JuanDavidBuitrago commented Nov 16, 2022

Description

This PR adds a custom filter pipeline to get course enrollments from tenant site where a user makes the request.

The idea is including some changes in openedx-filters and edx-platform repositories to anyone implement the filter function, and one clear example to use is this custom pipeline on eox-tenant plugin.

Dependencies for now:

Future dependencies:

  • openedx/openedx-filters
  • openedx/edx-platfom

Testing instructions

  1. Create an environment, you can use strain.yml bellow.
STRAIN_NAME: nuez
STRAIN_TUTOR_VERSION: v14.1.0
DOCKER_IMAGE_OPENEDX_DEV: docker.io/ednxops/distro-edunext-edxapp-dev:nuez
DOCKER_IMAGE_OPENEDX: docker.io/ednxops/distro-edunext-edxapp:nuez
EDX_PLATFORM_REPOSITORY: https://github.com/eduNEXT/edunext-platform.git
EDX_PLATFORM_VERSION: ednx-release/nuez.master
CMS_HOST: studio.nutmeg.edunext.link
LMS_HOST: lms.nutmeg.edunext.link
DEV_PROJECT_NAME: nuez_dev
LOCAL_PROJECT_NAME: nuez_local
PLATFORM_NAME: Nuez
STRAIN_TUTOR_PLUGINS:
  - REPO: tutor-contrib-edunext-distro
    VERSION: v3.0.0
    EGG: tutor-contrib-edunext-distro==v3.0.0
    PACKAGE_NAME: distro
    PROTOCOL: ssh
STRAIN_EXTRA_COMMANDS:
  - APP: 'tutor'
    COMMAND: 'distro enable-themes'
DISTRO_EOX_TENANT_DPKG:
  index: git
  name: eox-tenant
  private: false
  repo: eox-tenant
  domain: github.com
  path: eduNEXT
  protocol: https
  variables:
    development: {}
    production: {}
  version: JDB/add_filter_enrollment_site
DISTRO_THEMES_NAME:
  - bragi
  1. Create two Tenant sites and add at less one course on each one. Go on to create sites: http://lms.nutmeg.edunext.link:8000/admin/eox_tenant/tenantconfig/
  2. In a course, in Studio, set Mobile Course Available true. Go on to configure the key: studio.nutmeg.edunext.link:8001/settings/advanced/{your_course_id}
  3. Enroll a user (user don't have to be a staff user) in a course on different sites.
  4. Add the following configurations to your configuration site.
"OPEN_EDX_FILTERS_CONFIG": {
    "org.openedx.learning.course_enrollments_site.filter.requested.v1": {
        "fail_silently": false,
        "pipeline": [
            "eox_tenant.filters.pipeline.FilterUserCourseEnrollmentsByTenant"
        ]
    }
},
  1. Make a request in:
  • my_microsite.nutmeg.edunext.link:8000/api/enrollment/v1/enrollment
  • my_microsite.nutmeg.edunext.link:8000/api/mobile/v1/users/{username}/course_enrollments/
  1. You should see the courses where you are enrolled. Check when you don't use OPEN_EDX_FILTERS_CONFIG in your site, the request show all courses.

Additional information

Checklist for Merge

  • Tested in a remote environment
  • Updated documentation
  • Rebased master/main
  • Squashed commits

@JuanDavidBuitrago JuanDavidBuitrago self-assigned this Nov 16, 2022
@JuanDavidBuitrago JuanDavidBuitrago changed the title (FFI-3) filter user's course enrollment by microsite request (FFI-3/DS-300) filter user's course enrollment by microsite request Nov 16, 2022
@Alec4r
Copy link
Member

Alec4r commented Nov 21, 2022

@JuanDavidBuitrago please, can you create a readme file in the filters folder with docs about what filters contain and what is the objective of each one? thanks.

And also, I think that maybe the folder should have like name "pipelines" instead of "filters" and inside 1 file per pipeline, because the filters are in openedx-filter, right? or just use the file pipelines.py and remove the folder.

Why? Because in a future we want to order each eox-* by bounded context.

@JuanDavidBuitrago JuanDavidBuitrago force-pushed the JDB/add_filter_enrollment_site branch 2 times, most recently from 814544c to 18264d1 Compare November 22, 2022 03:30
@JuanDavidBuitrago
Copy link
Member Author

@JuanDavidBuitrago please, can you create a readme file in the filters folder with docs about what filters contain and what is the objective of each one? thanks.

And also, I think that maybe the folder should have like name "pipelines" instead of "filters" and inside 1 file per pipeline, because the filters are in openedx-filter, right? or just use the file pipelines.py and remove the folder.

Why? Because in a future we want to order each eox-* by bounded context.

@Alec4r, I added a readme file.

The pipeline inside of filters folder is a custom filter step, for that reason I named it like this, In openedx-filters there is only a filter structure that can be used from edx-platform. The idea is to add new filter steps in this folder, and I consider we should use this space to related with openedx-filters. For example, a Mafer's card has to implement a filter here.

FYI: eox-tenant already has a pipeline outside filter folder, but differ with the intention of filter steps pipelines: https://github.com/eduNEXT/eox-tenant/blob/master/eox_tenant/pipeline.py

Let me know what do you think with this feedback.

@Alec4r
Copy link
Member

Alec4r commented Nov 22, 2022

This file is a third party auth pipeline https://github.com/eduNEXT/eox-tenant/blob/master/eox_tenant/pipeline.py ... maybe we need think in rename it, but we can do it in a future.

Copy link
Member

@Alec4r Alec4r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job.

Copy link
Contributor

@Henrrypg Henrrypg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was already tested, Good job!

@JuanDavidBuitrago JuanDavidBuitrago merged commit f759510 into master Nov 22, 2022
@JuanDavidBuitrago JuanDavidBuitrago deleted the JDB/add_filter_enrollment_site branch November 22, 2022 16:34
@JuanDavidBuitrago JuanDavidBuitrago restored the JDB/add_filter_enrollment_site branch November 22, 2022 16:35
@JuanDavidBuitrago JuanDavidBuitrago deleted the JDB/add_filter_enrollment_site branch November 22, 2022 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants