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.
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 🤓
echo "127.0.0.1 idp.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 matrix.local" | sudo tee -a /etc/hosts
docker compose up -d
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
-
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
- 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 🎉
tox -e check_codestyle
tox -e py