Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Portal for the Informed Governance project.

License

Notifications You must be signed in to change notification settings

informed-governance-project/portal

Repository files navigation

Governance platform - Portal

Description

Portal for the Informed Governance project.

See more information about the architecture here.

Installation

Prerequisites

Generally speaking, requirements are the following:

  • A GNU/Linux distribution. Tested on Debian Bookworm;
  • Python version >= 3.9. Tested with Python 3.11;
  • A PostgreSQL server for persistent storage. Tested with PostgreSQL 15.3.

Get the code and install the dependencies

$ git clone https://github.com/informed-governance-project/portal.git
$ cd portal
$ npm ci
$ poetry install --only main

Configure the application

$ poetry shell

# Configure production settings:
$ cp portal/config_dev.py portal/config.py

$ python manage.py collectstatic

$ python manage.py migrate

Usage

Two different interfaces are available. A command line interface and a Web based interface (API).

Command line interface

Create a new module and a token access for an existing user:

$ python manage.py module_create --name monarc --path monarc --upstream http://127.0.0.1:5000/
New module created.

$ python manage.py access_create --username=john --module_name=monarc --token=SecureToken
New access created.

Revoke a user's access to a specified service:

$ python manage.py access_revoke --username=john --module_name=monarc
Access revoked.

API

It is possible to create new accesses via the API. Below is an example:

curl -X 'POST' \
  'http://127.0.0.1:8000/api/v1/externaltoken/' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic dG90bzpwYXNzd29yZA==' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFTOKEN: xj4Rk9PNbcavn5Sy3qSgnX2RzqepddKaxO3xyxyaKTxPueEuJ7QihevwJJjF2swa' \
  -d '{
  "username": "john",
  "module_name": "MONARC",
  "module_path": "monarc",
  "token": "SecureToken"
}'

Only an admin user is able to use this endpoint.

The user must already be in the database.

Revoke a user's access:

curl -X 'DELETE' \
  'http://127.0.0.1:8000/api/v1/externaltoken/5' \
  -H 'accept: */*' \
  -H 'Authorization: Basic dG90bzpwYXNzd29yZA==' \
  -H 'X-CSRFTOKEN: GmsOTMfZ2UbyyWRP25uxYY1cSDmvB3zEGRru7aYmBBySF5DLIMszSfuR2WrLqilE'

You can look at the documentation of the API: http://127.0.0.1:8000/api/v1/swagger-ui/

License

This software is licensed under GNU Affero General Public License version 3

About

Portal for the Informed Governance project.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published