GitLab external user creator
This small app allows internal users to create new external users (introduced in GitLab 8.6). For example in our research group we want to invite external collaborators without the need to be a system administrator.
Setup and installation
It is common to work in a Python virtualenv. There the basic steps to install all dependencies would be:
virtualenv venv . ./venv/bin/activate pip install -r requirements.txt
The app expects a file
settings.cfg containing the following parameters.
|GITLAB_BASE||Base URL to the GitLab installation (without the /api/v3 part)|
|GITLAB_CONSUMER_KEY||Application Id provided by GitLab|
|GITLAB_CONSUMER_SECRET||Secret provided by GitLab|
|GITLAB_ADMIN_TOKEN||Private token of a GitLab administrator|
|CSRF_SECRET||Some long string which will be used to secure the html forms|
|...||More Flask parameters can also be provided in this configuration|
An example configuration is provided in settings.example.cfg.
- Register the application for GitLab OAuth.
- In the GitLab Admin area, enter the Applications settings.
- Start a New Application with the corresponding button.
- Enter some name, e.g. "External User Creator".
- Enter the Redirect URI. This must be "DOMAIN/oauth-authorized", where DOMAIN depends on your installation. In development setups you can use "http://localhost:5000/oauth-authorized".
- Confirm and copy the Application Id and Secret generated by GitLab in your
- Obtain an administrator private token.
- Login as an admin and navigate to Profile settings > Account. There you will find the Private token which is needed to create users via the API.
Launching the app
For development purposes one can use the built-in Flask/Werkzeug webserver:
For this setup the Redirect URI in the GitLab settings should contain something like
In production it is adviced to use some production WSGI server. Read more on the Flask deployment documentation.
Example for a deployment on the same server running our local GitLab installation is in DEPLOY.md.
Copyright on the application belongs to the Institute for Theoretical Physics, ETH Zurich.
This project ships copies of the Bootstrap framework and the jQuery library, which contain their own copyright.