zgzgorg / iam-backend

0 stars 2 forks source link

IAM Backend

Codacy Badge Language grade: Python Maintainability Actions Status Actions Status codecov

An Identity Access Management (IAM) system using Google Workspace accounts.

Intended Users. This system is intended for use at Community Builder Toolbox, Inc., a California-based 501(c)(3) non-profit organization. It is currently incubated under ZaiGeZaiGu, a volunteer platform for Chinese in the SF Bay Area.

Installation

Set up the environment

Assuming you have GitHub CLI installed (possibly via brew install gh) and uses Conda as your environment manager, execute the following commands:

git clone zgzgorg/iam-backend # Clone the repo.
cd iam-backend
conda create -n zgiam python=3.8
conda activate zgiam
make develop

Bootstrap the database

You can skip this section if you're provided with a zgiam.sql file.

  1. Run make update-schema. This will create an empty SQLite file at zgiam/zgiam.sql.
  2. Open this file with a SQLite editor of your choice. We recommend DBeaver, which you can install via brew install --cask dbeaver-community (assuming you have Homebrew installed).
  3. Insert a row to the table account. Provide the following required fields:

    1. email -- You must be able to receive emails via this email address.
    2. first_name
    3. last_name
    4. phone_number
  4. Save and exit.

Run the server

Someone should've sent you an iam_sqlite.cfg. Place it under the repo's directory. Run:

IAM_CONFIG_PATH=$PWD/iam_sqlite.cfg python zgiam/app.py

Now, go to http://127.0.0.1:5000/api/v1/. You should see a page similar to this screenshot.

Configuration

Using a file. By default, iam-backend reads /etc/zgiam/zgiam.cfg for configs. The file supports a dialect of the INI file structure defined by the Python 3 standard library configparser. A sample zgiam.cfg file can be found at zgiam/conf/default_iam.cfg. You can override the default path via the environment variable IAM_CONFIG_PATH.

Using environment variables. All variables in this file are also overridable via environment variables. The overriding environment variable should follow the format of IAM_{section}_{option}. For example:

Styles, Conventions, and Standards

This repo adheres to the following practices:

Further, this repo uses these dev-cycle tools:

Structure

This repo uses these modules: