learningequality / ka-lite

KA Lite: lightweight web server for serving core Khan Academy content (videos and exercises) without needing internet connectivity
https://learningequality.org/ka-lite/
Other
456 stars 304 forks source link

Clean up old code in kalite.contentload #5444

Open benjaoming opened 7 years ago

benjaoming commented 7 years ago

Summary

Most of kalite.contentload seems to be outdated, both on distributed and central server.

Here's a snippet from kalite.contentload.api_views:

"""
This file implements both the central and distributed server sides of
a handshake to download KA data.

Why does the central server have to be involved?
  - because we have exactly one API Key for KA, and we don't want to share it
  with distributed server accounts.
  - because we don't trust KA to keep their API static; by putting the central
  server in the middle, we can easily update, and distributed servers don't break.

Here's how it works:
* On the distributed server, there is a button on the facility user's "account" page with a button"Download data from KA".
* That button has a link to a distributed server url.  The user clicks it.
* That distributed server view sets up a proper URL/request to the central server, then redirects that central server URL.
* The central server tries to authenticate to KA (forwarding users to KA), with a call-back URL when that succeeds.
* The user authenticates with KA, and KA oauth is returned to the central server.
* The central server then uses the KA API to get the user data, interpret it, massage it, and compute (our) relevant quantities.
* The central server then uses a distributed server call-back URL to POST the downloaded user data.
* The distributed server gets that data, loads it, saves it, and then redirects the user--to their account page.
* The account page shows again, this time including the imported KA data
"""

System information

benjaoming commented 7 years ago

Adding to this: control_panel.views.account_management seems to invoke one remaining view update_all_distributed, however account_management is unused both on the central and distributed server.

So we can probably get rid of account_management, too.

Going to try to confirm this. However, I couldn't make a teacher account access /management/account/ which just seems blank. On a student account, it returns 404.