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

chore: example #15

Open
wants to merge 1 commit into
base: tecoholic/create-cea-for-invite-only-courses-before-checkout
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions enterprise/pipeline.py
@@ -0,0 +1,24 @@
from openedx_filters import PipelineStep


class InviteOnlyEnrollments(PipelineStep):
"""
Add the following to the end of edx-platform/lms/envs/devstack.py file:

OPEN_EDX_FILTERS_CONFIG = {
"org.openedx.learning.course.enrollment.started.v1": {
"fail_silently": False,
"pipeline": [
"enterprise.pipeline.InviteOnlyEnrollments"
]
}
}

This will hook into the CourseEnrollmentStarted filter here: https://github.com/openedx/edx-platform/blob/592bc66b3fe5c14bafb7e44ea9e57328fe1dde06/common/djangoapps/student/models/course_enrollment.py#L658-L660
and allow you to inspect the data that is being passed to the filter.
"""

def run_filter(self, *args, **kwargs):
import ipdb
ipdb.set_trace()
return {}
Comment on lines +21 to +24
Copy link
Member Author

Choose a reason for hiding this comment

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

From the ticket description:

The filter hook will grab the relevant information from the request object like the enterprise id, catalog id, user id..etc., validate that they are allowed to enroll in the course and create the CourseEnrollmentAllowed object. This will allow them to successfully enroll without staff having to explicitly enrolle each user.

Unless we were going to modify the filter itself, it looks like the request object can't be accessed here.

The signature of this method is the same as this one.