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.
master
Alejandro Sirgo Rica 2024-07-08 17:35:37 +02:00 committed by lupoDharkael
parent 5cbb4a7562
commit 471cb78676
1 changed files with 2 additions and 1 deletions

View File

@ -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