diff options
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 0d80cc7..b008673 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1678,6 +1678,15 @@ def users(): return render_template('users.html', users=users) +def get_available_centers(): + responses = multi_request('get', '/scopes') + available_centers = list() + for resp in responses: + centers = parse_scopes_from_tree(resp['json'], 'center') + centers = [(center['name'], center['name']) for center in centers] + available_centers.extend(centers) + return available_centers + def get_available_scopes(): responses = multi_request('get', '/scopes') available_scopes = list() @@ -1809,7 +1818,7 @@ def delete_user(username): @login_required def user_add_get(): form = UserForm() - form.scopes.choices = get_available_scopes() + form.scopes.choices = get_available_centers() return render_template('auth/add_user.html', form=form) @@ -1847,7 +1856,7 @@ def user_edit_get(): form.username.render_kw = {'readonly': True} form.admin.data = user.get('ADMIN') form.scopes.data = user.get('SCOPES') - form.scopes.choices = get_available_scopes() + form.scopes.choices = get_available_centers() return render_template('auth/edit_user.html', form=form) |