From 471cb78676a4269cd0809be1bea8d73babaa856f Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 8 Jul 2024 17:35:37 +0200 Subject: views: fix user scope filtering Create a copy of the array with scope references before the iteration and modification of the scopes dictionary. Prevent skipping values after deleting an element during the scope iteration. --- ogcp/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ogcp/views.py b/ogcp/views.py index 1f84621..c1da3f0 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -251,7 +251,8 @@ def add_state_and_ips(scope, clients, ips): return scope['ip'] def remove_disabled_scopes(scopes): - for scope in scopes.get('scope'): + scope_list = scopes.get('scope')[:] + for scope in scope_list: if scope.get('type') == 'center': if str(scope.get('id')) in current_user.scopes: continue -- cgit v1.2.3-18-g5258