-
-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(accessLogsExport): create new endpoints TASK-1147 #5304
base: main
Are you sure you want to change the base?
Conversation
…ate csv files for access logs, and added tests
…t_email_subject to the ProjectView and AccessLog export tasks
…access-logs-export
…/kpi into endpoints-for-access-logs-export
This reverts commit dd5650d.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this more declarative/django-y if we use 2 different endpoints (like we do for viewing access logs).
We can use filter_backends and permission_classes like we do in the AllAccessLogViewSet and AccessLogViewSet to handle filtering down to the correct user and only allowing super users. That should allow us to get rid of a lot of the if-elses and having to check the request path, which is a little brittle (sometimes we might want to change the url of something without changing its functionality).
Also the endpoints need documentation :)
return Response( | ||
{'uid': task.uid, 'status': task.status}, status=status.HTTP_200_OK | ||
) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No 404 here. An empty list is not an error response
🗒️ Checklist
<type>(<scope>)<!>: <title> TASK-1234
frontend
orbackend
unless it's global👷 Description for instance maintainers
Create two new endpoints for access log exports which will return the status of the export job. One endpoint is restricted for superusers and allows them to access all logs while the other endpoint is for regular users to access their own logs.
👀 Preview steps
Test
/api/v2/access-logs/export
[ "status: created" ]
with this response:
Test
/api/v2/access-logs/me/export
Follow the same testing instructions above but skip number 7 as both superusers and regular users have the same access to the endpoint.
🟢 Also verify that making a POST request on both endpoints should now generate an email with the follow format: