Skip to content

Commit

Permalink
Update README.md (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
dubdabasoduba authored and sharon2719 committed Sep 23, 2024
1 parent e5de4d6 commit 2689ee0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions importer/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Setup Keycloak Roles

This script is used to setup keycloak roles and groups. It takes in a csv file with the following columns:
This script is used to set up keycloak roles and groups. It takes in a CSV file with the following columns:

- **role**: The actual names of the roles you would like to create
- **composite**: A boolean value that tells if the role has composite roles or not
- **associated_roles**: Roles to be created/added to the main role as associated roles

### Options

- `setup` : (Required) This needs to be set to "roles" in order to initiate the setup process
- `csv_file` : (Required) The csv file with the list of roles
- `setup` : (Required) This needs to be set to "roles" to initiate the setup process
- `csv_file` : (Required) The CSV file with the list of roles
- `group` : (Not required) This is the actual group name. If not passed then the roles will just be created but not assigned to any group
- `roles_max` : (Not required) This is the maximum number of roles to pull from the api. The default is set to 500. If the number of roles in your setup is more than this you will need to change this value
- `roles_max` : (Not required) This is the maximum number of roles to pull from the API. The default is set to 500. If the number of roles in your setup is more than this you will need to change this value
- `default_groups` : (Not Required) This is a boolean value to turn on and off the assignment of default roles. The default value is `true`


### To run script
1. Create virtualenv
2. Install requirements.txt - `pip install -r requirements.txt`
3. Set up your _.env_ file, see sample below. Populate it with the right credentials, you can either provide an access token or client credentials. Ensure that the user whose details you provide in this _.env_ file has the necessary permissions/privileges.
3. Set up your _.env_ file, see the sample below. Populate it with the right credentials, you can either provide an access token or client credentials. Ensure the user whose details you provide in this _.env_ file has the necessary permissions/privileges.
4. Run script - `python3 main.py --setup roles --csv_file csv/setup/roles.csv --group Supervisor`
5. If you are running the script without `https` setup e.g locally or a server without https setup, you will need to set the `OAUTHLIB_INSECURE_TRANSPORT` environment variable to 1. For example `export OAUTHLIB_INSECURE_TRANSPORT=1 && python3 main.py --setup roles --csv_file csv/setup/roles.csv --group OpenSRP_Provider --log_level debug`
5. If you are running the script without `https` setup e.g. locally or a server without https setup, you will need to set the `OAUTHLIB_INSECURE_TRANSPORT` environment variable to 1. For example `export OAUTHLIB_INSECURE_TRANSPORT=1 && python3 main.py --setup roles --csv_file csv/setup/roles.csv --group OpenSRP_Provider --log_level debug`
6. You can turn on logging by passing a `--log_level` to the command line as `info`, `debug` or `error`. For example `python3 main.py --setup roles --csv_file csv/setup/roles.csv --group Supervisor --log_level debug`


Expand All @@ -30,6 +30,7 @@ client_id = 'example-client-id'
client_secret = 'example-client-secret'
fhir_base_url = 'https://example.smartregister.org/fhir'
keycloak_url = 'https://keycloak.smartregister.org/auth'
realm = 'example-realm'
# access token for access to where product images are remotely stored
product_access_token = 'example-product-access-token'
Expand Down

0 comments on commit 2689ee0

Please sign in to comment.