Skip to content

Administration

Mathias Stuhlmacher edited this page Jun 19, 2022 · 2 revisions

Administration

In addition to the built-in admin page and management commands, some custom management commands have been implemented. These are intended to help simplify repetitive administrative activities for which there will be no implementation in the GUI.

Custom management commands

Add users

  • Module:
    • dfirtrack_main.management.commands.add_users
  • Version: v2.4.11 or above
  • Basic usage: python manage.py add_users <USERFILE>

Add users from CSV file containing <USERNAME>,<PASSWORD>. Optionally, access to the admin area can be granted with --is_staff.

python manage.py add_users --help
usage: manage.py add_users [-h] [-s] [-d {COMMA,SEMICOLON,PIPE}] [-q {SINGLE,DOUBLE}] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] userfile

Add users from file.

positional arguments:
  userfile              A CSV file containing user names and passwords (<USER>,<PASSWORD>).

optional arguments:
  -h, --help            show this help message and exit
  -s, --is_staff        Designates whether the users can access the admin site.
  -d {COMMA,SEMICOLON,PIPE}, --delimiter {COMMA,SEMICOLON,PIPE}
                        Delimiter used in CSV file (defaults to "COMMA").
  -q {SINGLE,DOUBLE}, --quotechar {SINGLE,DOUBLE}
                        Quotechar used in CSV file (defaults to "SINGLE").
  --version             Show program's version number and exit.
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions.
  --no-color            Don't colorize the command output.
  --force-color         Force colorization of the command output.
  --skip-checks         Skip system checks.

Add users to group

  • Module:
    • dfirtrack_main.management.commands.add_users_to_group
  • Version: v2.4.11 or above
  • Basic usage: python manage.py add_users_to_group <USERFILE> <GROUPNAME>

Add users from CSV file to group. A text file with a user name per line is also suitable for this purpose. For the sake of simplicity, CSV has been implemented so that the same file as used by the add_users command can be used again.

python manage.py add_users_to_group --help
usage: manage.py add_users_to_group [-h] [-d {COMMA,SEMICOLON,PIPE}] [-q {SINGLE,DOUBLE}] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] userfile groupname

Add users from file to group.

positional arguments:
  userfile              A CSV file containing user names in first column.
  groupname             The group name to add the users.

optional arguments:
  -h, --help            show this help message and exit
  -d {COMMA,SEMICOLON,PIPE}, --delimiter {COMMA,SEMICOLON,PIPE}
                        Delimiter used in CSV file (defaults to "COMMA").
  -q {SINGLE,DOUBLE}, --quotechar {SINGLE,DOUBLE}
                        Quotechar used in CSV file (defaults to "SINGLE").
  --version             Show program's version number and exit.
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions.
  --no-color            Don't colorize the command output.
  --force-color         Force colorization of the command output.
  --skip-checks         Skip system checks.