summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-09-22 17:54:44 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-09-29 13:01:28 +0200
commitcb2f534f6425d4b48e5c531a11a85e45cdd7db41 (patch)
treef8ff479449b5e77cd85375e7865cf29d3dace974 /ogcp
parent4f3c66f04aebf3d571c3ba14f525b0e9a1dc1d55 (diff)
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.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py16
1 files 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):