Skip to content

compilerla/compiler-admin

Repository files navigation

Compiler Admin

Automating Compiler's administrative tasks.

Built on top of GAMADV-XTD3 and GYB.

Note: This tool can only be used by those with administrator access to Compiler's Google Workspace.

Usage

$ compiler-admin -h
usage: compiler-admin [-h] [-v] {info,init,time,user} ...

positional arguments:
  {info,init,time,user}
                        The command to run
    info                Print configuration and debugging information.
    init                Initialize a new admin project. This command should be run once before any others.
    time                Work with Compiler time entries.
    user                Work with users in the Compiler org.

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit

Getting started

git clone https://github.com/compilerla/compiler-admin.git

cd compiler-admin

Now open in VS Code, and when prompted, reopen in the devcontainer.

Initial setup

Initial setup of a GAMADV-XTD3 project and GYB project is required to provide necessary API access to the Google Workspace.

$ compiler-admin init -h
usage: compiler-admin init [-h] [--gam] [--gyb] username

positional arguments:
  username    A Compiler user account name, sans domain.

options:
  -h, --help  show this help message and exit
  --gam       If provided, initialize a new GAM project.
  --gyb       If provided, initialize a new GYB project.

The init commands follows the steps in the GAMADV-XTD3 Wiki.

Additionally, GYB is used for Gmail backup/restore. See the GYB Wiki for more information.

Working with time entires

The time command provides an interface for working with time entries from Compiler's various systems:

$ compiler-admin time -h
usage: compiler-admin time [-h] {convert} ...

positional arguments:
  {convert}   The time command to run.
    convert   Convert a time report from one format into another.

options:
  -h, --help  show this help message and exit

Converting an hours report

With a CSV exported from either Harvest or Toggl, use this command to convert to the opposite format:

$ compiler-admin time convert -h
usage: compiler-admin time convert [-h] [--input INPUT] [--output OUTPUT] [--client CLIENT]

options:
  -h, --help       show this help message and exit
  --input INPUT    The path to the source data for conversion. Defaults to stdin.
  --output OUTPUT  The path to the file where converted data should be written. Defaults to stdout.
  --client CLIENT  The name of the client to use in converted data.

Working with users

The following commands are available to work with users in the Compiler domain:

$ compiler-admin user -h
usage: compiler-admin user [-h] {create,convert,delete,offboard,reset-password,restore,signout} ...

positional arguments:
  {create,convert,delete,offboard,reset-password,restore,signout}
                        The user command to run.
    create              Create a new user in the Compiler domain.
    convert             Convert a user account to a new type.
    delete              Delete a user account.
    offboard            Offboard a user account.
    reset-password      Reset a user's password to a randomly generated string.
    restore             Restore an email backup from a prior offboarding.
    signout             Signs a user out from all active sessions.

options:
  -h, --help            show this help message and exit

Creating a user

$ compiler-admin user create -h
usage: compiler-admin user create [-h] [--notify NOTIFY] username

positional arguments:
  username         A Compiler user account name, sans domain.

options:
  -h, --help       show this help message and exit
  --notify NOTIFY  An email address to send the newly created account info.

Additional options are passed through to GAM, see more about GAM user create

Convert a user

$ compiler-admin user convert -h
usage: compiler-admin user convert [-h] username {contractor,partner,staff}

positional arguments:
  username              A Compiler user account name, sans domain.
  {contractor,partner,staff}
                        Target account type for this conversion.

options:
  -h, --help            show this help message and exit

Offboarding a user

$ compiler-admin user offboard -h
usage: compiler-admin user offboard [-h] [--alias ALIAS] [--force] username

positional arguments:
  username       A Compiler user account name, sans domain.

options:
  -h, --help     show this help message and exit
  --alias ALIAS  Account to assign username as an alias.
  --force        Don't ask for confirmation before offboarding.

This script creates a local backup of USER's inbox, see Restore

Restore an email backup

Retore a backup from a prior Offboarding into the archive@compiler.la account.

$ compiler-admin user restore -h
usage: compiler-admin user restore [-h] username

positional arguments:
  username    The user's account name, sans domain.

options:
  -h, --help  show this help message and exit