From cb2f534f6425d4b48e5c531a11a85e45cdd7db41 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Thu, 22 Sep 2022 17:54:44 +0200 Subject: Get available scopes from all the servers When creating o editing a user, you can select in which scopes from all servers the user has permission. --- ogcp/views.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ogcp/views.py b/ogcp/views.py index 9374606..981892b 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1483,12 +1483,16 @@ def users(): def get_available_scopes(): - resp = g.server.get('/scopes') - centers = parse_scopes_from_tree(resp.json(), 'center') - centers = [(center['name'], center['name']) for center in centers] - rooms = parse_scopes_from_tree(resp.json(), 'room') - rooms = [(room['name'], room['name']) for room in rooms] - return centers + rooms + responses = multi_request('get', '/scopes') + available_scopes = list() + for resp in responses: + centers = parse_scopes_from_tree(resp['json'], 'center') + centers = [(center['name'], center['name']) for center in centers] + available_scopes.extend(centers) + rooms = parse_scopes_from_tree(resp['json'], 'room') + rooms = [(room['name'], room['name']) for room in rooms] + available_scopes.extend(rooms) + return available_scopes def save_server(form): -- cgit v1.2.3-18-g5258