summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-08 17:35:37 +0200
committerlupoDharkael <izhe@hotmail.es>2024-07-09 09:52:21 +0200
commit471cb78676a4269cd0809be1bea8d73babaa856f (patch)
tree26678265a2c71d611e95b7ee78df5aa81f4289bd
parent5cbb4a7562d126dd8eaa0a304f95274edf074582 (diff)
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.
-rw-r--r--ogcp/views.py3
1 files changed, 2 insertions, 1 deletions
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