Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
7f4bd900
Commit
7f4bd900
authored
Oct 05, 2015
by
Peter Fogg
Committed by
Calen Pennington
Oct 05, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add management command to set SoftwareSecure verification status.
parent
c78b1be5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
lms/djangoapps/verify_student/management/commands/set_software_secure_status.py
+60
-0
No files found.
lms/djangoapps/verify_student/management/commands/set_software_secure_status.py
0 → 100644
View file @
7f4bd900
"""
Manually set Software Secure verification status.
"""
import
sys
from
django.core.management.base
import
BaseCommand
from
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
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment