Merge pull request #17788 from edx/bexline/verify_student_cleanup
ENT-934 Remove deprecated models in verify_student
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
"""
|
||||
Manually set Software Secure verification status.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from lms.djangoapps.verify_student.models import (
|
||||
SoftwareSecurePhotoVerification,
|
||||
VerificationCheckpoint,
|
||||
VerificationStatus
|
||||
)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
Command to trigger the actions that would normally follow Software Secure
|
||||
returning with the results of a photo verification.
|
||||
"""
|
||||
|
||||
args = "<{approved, denied}, SoftwareSecurePhotoVerification id, [reason_for_denial]>"
|
||||
|
||||
def handle(self, *args, **kwargs): # pylint: disable=unused-argument
|
||||
from lms.djangoapps.verify_student.views import _set_user_requirement_status
|
||||
|
||||
status_to_set = args[0]
|
||||
receipt_id = args[1]
|
||||
|
||||
try:
|
||||
attempt = SoftwareSecurePhotoVerification.objects.get(receipt_id=receipt_id)
|
||||
except SoftwareSecurePhotoVerification.DoesNotExist:
|
||||
self.stderr.write(
|
||||
'SoftwareSecurePhotoVerification with id {id} could not be found.\n'.format(id=receipt_id)
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
if status_to_set == 'approved':
|
||||
self.stdout.write('Approving verification for {id}.\n'.format(id=receipt_id))
|
||||
attempt.approve()
|
||||
_set_user_requirement_status(attempt, 'reverification', 'satisfied')
|
||||
|
||||
elif status_to_set == 'denied':
|
||||
self.stdout.write('Denying verification for {id}.\n'.format(id=receipt_id))
|
||||
if len(args) >= 3:
|
||||
reason_for_denial = args[2]
|
||||
else:
|
||||
reason_for_denial = 'Denied via management command.'
|
||||
attempt.deny(reason_for_denial)
|
||||
_set_user_requirement_status(attempt, 'reverification', 'failed', reason_for_denial)
|
||||
|
||||
else:
|
||||
self.stdout.write('Cannot set id {id} to unrecognized status {status}'.format(
|
||||
id=receipt_id, status=status_to_set
|
||||
))
|
||||
sys.exit(1)
|
||||
|
||||
checkpoints = VerificationCheckpoint.objects.filter(photo_verification=attempt).all()
|
||||
VerificationStatus.add_status_from_checkpoints(
|
||||
checkpoints=checkpoints,
|
||||
user=attempt.user,
|
||||
status=status_to_set
|
||||
)
|
||||
@@ -0,0 +1,65 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('verify_student', '0004_delete_historical_records'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='icrvstatusemailsconfiguration',
|
||||
name='changed_by',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='incoursereverificationconfiguration',
|
||||
name='changed_by',
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='skippedreverification',
|
||||
unique_together=set([]),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='skippedreverification',
|
||||
name='checkpoint',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='skippedreverification',
|
||||
name='user',
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='verificationcheckpoint',
|
||||
unique_together=set([]),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='verificationcheckpoint',
|
||||
name='photo_verification',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='verificationstatus',
|
||||
name='checkpoint',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='verificationstatus',
|
||||
name='user',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='IcrvStatusEmailsConfiguration',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='InCourseReverificationConfiguration',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='SkippedReverification',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='VerificationCheckpoint',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='VerificationStatus',
|
||||
),
|
||||
]
|
||||
@@ -19,7 +19,6 @@ from email.utils import formatdate
|
||||
import pytz
|
||||
import requests
|
||||
import six
|
||||
from config_models.models import ConfigurationModel
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.cache import cache
|
||||
@@ -43,7 +42,6 @@ from lms.djangoapps.verify_student.ssencrypt import (
|
||||
)
|
||||
from openedx.core.djangoapps.signals.signals import LEARNER_NOW_VERIFIED
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangolib.model_mixins import DeprecatedModelMixin
|
||||
from openedx.core.storage import get_storage
|
||||
|
||||
|
||||
@@ -1121,74 +1119,3 @@ class VerificationDeadline(TimeStampedModel):
|
||||
def invalidate_deadline_caches(sender, **kwargs): # pylint: disable=unused-argument
|
||||
"""Invalidate the cached verification deadline information. """
|
||||
cache.delete(VerificationDeadline.ALL_DEADLINES_CACHE_KEY)
|
||||
|
||||
|
||||
class VerificationCheckpoint(DeprecatedModelMixin, models.Model): # pylint: disable=model-missing-unicode
|
||||
"""
|
||||
DEPRECATED - do not use. To be removed in a future Open edX release (Hawthorn).
|
||||
"""
|
||||
course_id = CourseKeyField(max_length=255, db_index=True)
|
||||
checkpoint_location = models.CharField(max_length=255)
|
||||
photo_verification = models.ManyToManyField(SoftwareSecurePhotoVerification)
|
||||
|
||||
class Meta(object):
|
||||
app_label = "verify_student"
|
||||
unique_together = ('course_id', 'checkpoint_location')
|
||||
|
||||
|
||||
class VerificationStatus(DeprecatedModelMixin, models.Model): # pylint: disable=model-missing-unicode
|
||||
"""
|
||||
DEPRECATED - do not use. To be removed in a future Open edX release (Hawthorn).
|
||||
"""
|
||||
SUBMITTED_STATUS = "submitted"
|
||||
APPROVED_STATUS = "approved"
|
||||
DENIED_STATUS = "denied"
|
||||
ERROR_STATUS = "error"
|
||||
|
||||
VERIFICATION_STATUS_CHOICES = (
|
||||
(SUBMITTED_STATUS, SUBMITTED_STATUS),
|
||||
(APPROVED_STATUS, APPROVED_STATUS),
|
||||
(DENIED_STATUS, DENIED_STATUS),
|
||||
(ERROR_STATUS, ERROR_STATUS)
|
||||
)
|
||||
|
||||
checkpoint = models.ForeignKey(VerificationCheckpoint, related_name="checkpoint_status")
|
||||
user = models.ForeignKey(User)
|
||||
status = models.CharField(choices=VERIFICATION_STATUS_CHOICES, db_index=True, max_length=32)
|
||||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
response = models.TextField(null=True, blank=True)
|
||||
error = models.TextField(null=True, blank=True)
|
||||
|
||||
class Meta(object):
|
||||
app_label = "verify_student"
|
||||
get_latest_by = "timestamp"
|
||||
verbose_name = "Verification Status"
|
||||
verbose_name_plural = "Verification Statuses"
|
||||
|
||||
|
||||
class InCourseReverificationConfiguration(DeprecatedModelMixin, ConfigurationModel): # pylint: disable=model-missing-unicode
|
||||
"""
|
||||
DEPRECATED - do not use. To be removed in a future Open edX release (Hawthorn).
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class IcrvStatusEmailsConfiguration(DeprecatedModelMixin, ConfigurationModel): # pylint: disable=model-missing-unicode
|
||||
"""
|
||||
DEPRECATED - do not use. To be removed in a future Open edX release (Hawthorn).
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class SkippedReverification(DeprecatedModelMixin, models.Model): # pylint: disable=model-missing-unicode
|
||||
"""
|
||||
DEPRECATED - do not use. To be removed in a future Open edX release (Hawthorn).
|
||||
"""
|
||||
user = models.ForeignKey(User)
|
||||
course_id = CourseKeyField(max_length=255, db_index=True)
|
||||
checkpoint = models.ForeignKey(VerificationCheckpoint, related_name="skipped_checkpoint")
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta(object):
|
||||
app_label = "verify_student"
|
||||
unique_together = (('user', 'course_id'),)
|
||||
|
||||
Reference in New Issue
Block a user