eimis-ans / eimis-synapse-tools

Some scripts to manage user enrollment on a Synapse homeserver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EIMIS Synapse tools

Gitmoji python License

Prerequisites

  • Python3 and pip or docker installed
  • a Synapse server available with its Synapse secret
  • a user having admin rights on Synapse homeserver
  • Poetry installed for development

Configuration

Set the configurations in an .env file :

HOMESERVER_URL=https://matrix.example.com
SYNAPSE_SECRET=
ADMIN_USERNAME=
ADMIN_PASSWORD=

You can find SYNAPSE_SECRET in your homeserver configuration

Install

poetry install

Build docker image

docker build -t eimis-synapse-tools .

Usage

Help

See all commands:

poetry run eimis-synapse-tools --help

Or with docker image

docker run eimisans/eimis-synapse-tools:latest --help

Import users

This tool will take as input a csv file:

| display_name            | username                    | email     |
| ----------------------- | --------------------------- | --------- |
| John Doe - CHU de Nancy | @johndoe:eimis.beta.gouv.fr | jd@pm.com |

Then the command:

poetry run eimis-synapse-tools import-users --dry-run --csv-file ./data/users.csv

Or with docker

docker run -v ./.env:/.env -v ./data/users.csv:/data/users.csv eimisans/eimis-synapse-tools:latest import-users --dry-run --csv-file /data/users.csv

(remove --dry-run to actually create the users)

Users can then go to their favorite client and click on forgot password.

Discovery room

poetry run eimis-synapse-tools setup-discoveryroom --help
poetry run eimis-synapse-tools setup-discoveryroom  -r matrix.develop.eimis.incubateur.net 

Or with docker

docker run  eimisans/eimis-synapse-tools:latest setup-discoveryroom -r matrix.develop.eimis.incubateur.net

Lint

Python lint with flake8.

poetry run flake8 --count --show-source --statistics

Static type check with mypy.

poetry run mypy . --no-namespace-packages

Tests

poetry run python -m unittest discover tests

About

Some scripts to manage user enrollment on a Synapse homeserver

License:MIT License


Languages

Language:Python 92.8%Language:Dockerfile 7.2%