main.py: Add group config

This commit is contained in:
Antoine Martin 2024-02-29 16:38:56 -05:00
parent e5c4c12ac6
commit 25cd8222aa
Signed by: forge
GPG key ID: D62A472A4AA7D541
2 changed files with 3 additions and 1 deletions

View file

@ -1,4 +1,5 @@
debug: "false"
group: "user"
authentik:
api_url: "https://authentik.company/api/v3"

View file

@ -12,6 +12,7 @@ with open ('./bridge.yml', 'r') as file:
# config parser
debug=config['debug']
group=config['group']
authentik_api_key=config['authentik']['api_key']
authentik_api_url=config['authentik']['api_url']
listmonk_api_key=config['listmonk']['api_key']
@ -19,7 +20,7 @@ listmonk_api_url=config['listmonk']['api_url']
listmonk_api_usr=config['listmonk']['api_usr']
def authentik_get_users():
url = authentik_api_url + '/core/users/' + '?type=internal&type=external' + '&groups_by_name=test-group'
url = authentik_api_url + '/core/users/' + '?type=internal&type=external' + '&groups_by_name=' + group
headers = {'accept': 'application/json', 'Authorization': "Bearer " + authentik_api_key}
resp = requests.get(url, headers=headers)
json_object = json.loads(resp._content)