Skip to content

Commit

Permalink
feat: separate PhotoVerification events
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacharis278 committed Oct 4, 2024
1 parent 5372992 commit 9162264
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ workspace {
grades_app -> signal_handlers "Emits COURSE_GRADE_NOW_PASSED signal"
verify_student_app -> signal_handlers "Emits IDV_ATTEMPT_APPROVED signal"
verify_student_app -> signal_handlers "Emits LEARNER_SSO_VERIFIED signal"
verify_student_app -> signal_handlers "Emits PHOTO_VERIFICATION_APPROVED signal"
student_app -> signal_handlers "Emits ENROLLMENT_TRACK_UPDATED signal"
allowlist -> signal_handlers "Emits APPEND_CERTIFICATE_ALLOWLIST signal"
signal_handlers -> generation_handler "Invokes generate_allowlist_certificate()"
Expand Down
2 changes: 2 additions & 0 deletions lms/djangoapps/certificates/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
COURSE_GRADE_NOW_FAILED,
COURSE_GRADE_NOW_PASSED,
LEARNER_SSO_VERIFIED,
PHOTO_VERIFICATION_APPROVED,
)
from openedx_events.learning.signals import EXAM_ATTEMPT_REJECTED, IDV_ATTEMPT_APPROVED

Expand Down Expand Up @@ -143,6 +144,7 @@ def _handle_id_verification_approved(user):


@receiver(LEARNER_SSO_VERIFIED, dispatch_uid="sso_learner_verified")
@receiver(PHOTO_VERIFICATION_APPROVED, dispatch_uid="photo_verification_approved")
def _listen_for_sso_verification_approved(sender, user, **kwargs): # pylint: disable=unused-argument
"""
Listen for a signal on SSOVerification indicating that the user has been verified.
Expand Down
11 changes: 3 additions & 8 deletions lms/djangoapps/verify_student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
rsa_decrypt,
rsa_encrypt
)
from openedx.core.djangoapps.signals.signals import LEARNER_SSO_VERIFIED
from openedx.core.djangoapps.signals.signals import LEARNER_SSO_VERIFIED, PHOTO_VERIFICATION_APPROVED
from openedx.core.storage import get_storage

from .utils import auto_verify_for_testing_enabled, earliest_allowed_verification_date, submit_request_to_ss
Expand Down Expand Up @@ -453,17 +453,12 @@ def approve(self, user_id=None, service=""):
self.save()

# Emit signal to find and generate eligible certificates
# This model uses the LEARNER_SSO_VERIFIED signal for backwards compatibility with changes
# to existing records. This model is being deprecated and all future IDV records
# will use the new VerificationAttempt model and corresponding openedx events signal.
# This is temporary until this model can be removed.
# DEPR details: https://github.com/openedx/edx-platform/issues/35128
LEARNER_SSO_VERIFIED.send_robust(
PHOTO_VERIFICATION_APPROVED.send_robust(
sender=PhotoVerification,
user=self.user,
)

message = 'LEARNER_SSO_VERIFIED signal fired for {user} from PhotoVerification'
message = 'PHOTO_VERIFICATION_APPROVED signal fired for {user} from PhotoVerification'
log.info(message.format(user=self.user.username))

@status_before_must_be("ready", "must_retry")
Expand Down
7 changes: 7 additions & 0 deletions openedx/core/djangoapps/signals/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,12 @@
# providing_args=['user']
LEARNER_SSO_VERIFIED = Signal()

# Signal that indicates a user has been verified via verify_studnet.PhotoVerification for certificate purposes
# Please note that this signal and the corresponding PhotoVerification model are planned for deprecation.
# Future implementations of IDV will use the verify_student.VerificationAttempt model and corresponding
# openedx events.
# DEPR: https://github.com/openedx/edx-platform/issues/35128
PHOTO_VERIFICATION_APPROVED = Signal()

# providing_args=['user']
USER_ACCOUNT_ACTIVATED = Signal() # Signal indicating email verification

0 comments on commit 9162264

Please sign in to comment.