eimis-ans / white-list-synapse-module

A Synapse module to easily manage a user whitelist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EIMIS experimentation whitelist Synapse module

Matrix GitHub Actions Workflow Status GitHub Actions Workflow Status License

Use case

Let's say you run an experiment in which you operate a Matrix server. An external ID provider is configured but you want to allow only specific users to join the experiment. You also want an easy way to manage a user whitelist.

Whitelist module

To do so, this repo contains a Synapse Module that will use check_registration_for_spam hook. It will allow users based on their mention in a specific whitelist room 🤓

Try it out

some /etc/hosts entries

echo "127.0.0.1 idp.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 matrix.local" | sudo tee -a /etc/hosts

Run the stack

docker compose up -d

Create users

Create a whitelist-manager and beta-tester user

  • Go to http://idp.local:8443
  • login with admin /admin
  • select local realm
  • users / Add a user
  • fill at least Username and save
  • go to Credentials tab and set a password

Create white list

  • Go to http://localhost:1983

  • Login with whitelist-manager user

  • Create an unencrypted room called Whitelist

  • Write a message containing some random user id

  • Get the room ID

  • edit docker-test-config/mx-conf/homeserver.yaml

  • fill this part:

      module: white_list_module.EimisWhiteList
      config:
        room_id: ROOM_IDs

Try to join

  • Open an other browser session
  • Go to http://localhost:1983
  • Try login with beta-tester user, you'll be denied
  • Go back to the whitelist room
  • edit your message or write a new message containing beta-tester username
  • -> You should be accepted 🎉

Dev

lint

tox -e check_codestyle

test

tox -e py

About

A Synapse module to easily manage a user whitelist

License:Apache License 2.0


Languages

Language:Python 93.8%Language:Shell 6.2%