mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-07-04 04:18:23 +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):
|
||||
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 (
|
||||
request.user.is_authenticated
|
||||
and getattr(request.user, "is_admin", False)
|
||||
and all_devices
|
||||
and getattr(request.user, "is_admin")
|
||||
and bool(all_devices)
|
||||
):
|
||||
pass
|
||||
else:
|
||||
|
Reference in New Issue
Block a user