For adding new users to the ESDL MapEditor or updating settings for existing users.
-
Create venv with required dependencies by
./setup.shor for windows create and activate venv (Python 3.12) followed by:
pip install setuptools pip install -r ./requirements.txt -
The parameters can be supplied via arguments or as environment variables, or a combination of both.
Via environment variables copy.env.templateto.env.
Or via args see help:python -m mapeditor_user_management.main --help python -m mapeditor_user_management.main add-users --help python -m mapeditor_user_management.main edit-users-settings --help
-
Run (optionally with arguments)
main.pyorrun.shwith the repo root as working directory (PyCharm mark thesrcfolder asSources Root).
The folder settings_not_committed can be used to store confidential user list/settings.
Below a description of the two modes: add-users and edit-users-config. See .env.template for more info on the
config parameters.
Add a specified list of users: create keycloak users, add optional keycloak roles and groups and set mapeditor settings in mongodb.
Edit settings (keycloak and/or mapeditor) for a list of users, or all users. There are three ways (EDIT_MODE) in which the config of the users can be edited:
update
Keycloak groups and roles will be added. For mapeditor settings the data in the json will be added, if not already present, to the current config of each user.
Caveat for lists: the whole list will be replaced (is it not possible to distinguish between adding a new item or updating an existing one).overwrite
Keycloak groups and roles will be added. The mapeditor config for all users will be overwritten by the supplied jsondelete
Keycloak groups and roles will be deleted. For mapeditor settings: the json items whose value is not a dictionary will be deleted (only the deepest item will be deleted).
To delete a higher level item change the value of the item to a string. Caveat for lists: it is not possible to remove specific list items.
Use ssh tunnel, for instance:
ssh -L 27019:localhost:27017 root@omotes-mapeditor-test.hesi.energy