mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-07-03 22:08:22 +00:00
refactor(DeviceListCreateAPIView): Update all_devices parameter handling for improved boolean parsing 🔨
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m30s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m30s
This commit is contained in:
@ -30,11 +30,15 @@ class DeviceListCreateAPIView(
|
|||||||
|
|
||||||
def list(self, request, *args, **kwargs):
|
def list(self, request, *args, **kwargs):
|
||||||
queryset = self.filter_queryset(self.get_queryset())
|
queryset = self.filter_queryset(self.get_queryset())
|
||||||
all_devices = request.query_params.get("all_devices", None)
|
all_devices = request.query_params.get("all_devices", "false").lower() in [
|
||||||
|
"true",
|
||||||
|
"1",
|
||||||
|
"yes",
|
||||||
|
]
|
||||||
if (
|
if (
|
||||||
request.user.is_authenticated
|
request.user.is_authenticated
|
||||||
and getattr(request.user, "is_admin", False)
|
and getattr(request.user, "is_admin")
|
||||||
and all_devices
|
and bool(all_devices)
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user