fix connectionless permissions by role & relation
This commit is contained in:
@@ -108,7 +108,10 @@ class PermissionViewSet(SoftDeleteMixin, viewsets.ModelViewSet):
|
|||||||
def connectionless_permissions(self, request, *args, **kwargs):
|
def connectionless_permissions(self, request, *args, **kwargs):
|
||||||
""" get all permissions that are not assigned to any user relation """
|
""" get all permissions that are not assigned to any user relation """
|
||||||
|
|
||||||
permissions = Permissions.objects.annotate(num=Count('userrelations')).filter(num=0) # noqa
|
permissions = Permissions.objects.annotate(
|
||||||
|
user_relation_num=Count('userrelations'), # noqa
|
||||||
|
role_num=Count('role'),
|
||||||
|
).filter(user_relation_num=0, role_num=0) # noqa
|
||||||
|
|
||||||
page = self.paginate_queryset(permissions)
|
page = self.paginate_queryset(permissions)
|
||||||
if page is not None:
|
if page is not None:
|
||||||
|
|||||||
@@ -37,3 +37,5 @@
|
|||||||
[2025-10-27 16:22:54,143] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\core\api.py changed, reloading.
|
[2025-10-27 16:22:54,143] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\core\api.py changed, reloading.
|
||||||
[2025-10-27 16:22:56,067] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
|
[2025-10-27 16:22:56,067] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
|
||||||
[2025-10-27 16:26:54,114] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\core\api.py changed, reloading.
|
[2025-10-27 16:26:54,114] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\core\api.py changed, reloading.
|
||||||
|
[2025-10-27 16:26:55,924] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
|
||||||
|
[2025-10-27 16:37:24,219] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authorization\api\v1\api.py changed, reloading.
|
||||||
|
|||||||
Reference in New Issue
Block a user