Skip to content

get_user

Timothy O'Connell edited this page Jun 12, 2017 · 3 revisions

It is possible to pull down all data (in python pickle form) for a given user via CLI (e.g. using curl). Among other things, this requires an admin key in the settings_private.cfg file.

After a fresh install, v1/settings_private.cfg should look like this:

[admin]
admin_key   = SET THIS TO A SECURE, UNIQUE VALUE IF RUNNING IN PRODUCTION

[smtp]
host        = smtp.gmail.com
pass        = SMTPPASSWORD
name        = [email protected]
name_pretty = KDM-Manager Administrator
no-reply    = [email protected]

In order to run get_user, follow these steps:

  1. On the server, change the admin_key value to something that can go nicely in a parameter string (I like to use a 12 character, random string).
  2. Get the user's ID, which is the bson-style Object ID of the user.
  3. From the client, make sure you've got curl installed, and then do this:
$ curl kdm-manager.com/get_user?admin_key=YOURADMINKEY\&u_id=THEUSERSOBJECTID > user_data.pickle

NB: make sure you escape the ampersand, or else bash will treat it literally and you'll get an error about missing the u_id parameter.

This will dump all of the user's data (including avatars) into the new file, user_data.pickle, which you can then import into your local installation of the app, using admin.py:

toconnell@mona:~/kdm-manager/v1$ curl kdm-manager.com/get_user?admin_key=ADMINKEY\&u_id=USEROBJCETID > 2016-06-12_userdata.pickle
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  417k    0  417k    0     0   248k      0 --:--:--  0:00:01 --:--:--  248k
toconnell@mona:~/kdm-manager/v1$ ./admin.py -i ~/qa/2016-06-12_userdata.pickle

If the user is not yours, i.e. and you do not know the password, the import command will ask you if you want to reset it to 'password'.

Clone this wiki locally