Skip to content

Commit

Permalink
feat: add filters before registration and user setttings context
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrrypg committed Nov 21, 2022
1 parent bb6ef9f commit 510f87e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions openedx_filters/learning/filters.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,51 @@
"""
Package where filters related to the learning architectural subdomain are implemented.
"""

from openedx_filters.exceptions import OpenEdxFilterException
from openedx_filters.tooling import OpenEdxPublicFilter
from openedx_filters.utils import SensitiveDataManagementMixin


class AccountSettingsRenderStarted(OpenEdxPublicFilter):
""" Custom class used to create Account settings filters. """

filter_type = "org.openedx.learning.student.settings.render.started.v1"

@classmethod
def run_filter(cls, context):
"""
Execute a filter with the signature specified.
Arguments:
context (dict): context for the account settings page.
"""
data = super().run_pipeline(context=context)
context = data.get("context")
return context


class StudentRegistrationRenderStarted(OpenEdxPublicFilter):
"""
Custom class used to add custom fields to the registration form.
"""

filter_type = "org.openedx.learning.student.registration.render.started.v1"

@classmethod
def run_filter(cls, form_desc):
"""
Execute a filter with the signature specified.
Arguments:
form_desc (dict): description form specifying the fields to be rendered
in the registration form.
"""
data = super().run_pipeline(form_desc=form_desc)
form_data = data.get("form_desc")
return form_data


class StudentRegistrationRequested(OpenEdxPublicFilter, SensitiveDataManagementMixin):
"""
Custom class used to create registration filters and its custom methods.
Expand Down

0 comments on commit 510f87e

Please sign in to comment.