filter permissions by modify_state

This commit is contained in:
2025-11-03 16:50:16 +03:30
parent 2f43428b1c
commit 68be3b11c0
2 changed files with 8 additions and 8 deletions

View File

@@ -74,14 +74,12 @@ class PermissionSerializer(serializers.ModelSerializer):
grouped[page_name].add(permission.name)
modifier_states[page_name].add(permission.modify_state)
structure = []
for page, access in grouped.items():
if not any(modifier_states[page]):
structure.append({
'page_name': page,
'page_access': sorted(list(access))
})
structure = [
{
'page_name': page,
'page_access': sorted(list(access))
} for page, access in grouped.items()
]
return structure

View File

@@ -1049,3 +1049,5 @@ TypeError: string indices must be integers, not 'str'
[2025-11-03 16:36:44,782] INFO django.server | IP: - | Path: - | "GET /auth/api/v1/user-relations/?role= HTTP/1.1" 200 14315
[2025-11-03 16:43:51,156] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authorization\api\v1\serializers.py changed, reloading.
[2025-11-03 16:43:57,776] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-11-03 16:50:08,668] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authorization\api\v1\serializers.py changed, reloading.
[2025-11-03 16:50:10,599] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader