Skip to content
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(projectHistoryLogs): add endpoints for viewing project history logs TASK-973 #5319

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rgraber
Copy link
Contributor

@rgraber rgraber commented Dec 3, 2024

🗒️ Checklist

  1. run linter locally
  2. update all related docs (API, README, inline, etc.), if any
  3. draft PR with a title <type>(<scope>)<!>: <title> TASK-1234
  4. tag PR: at least frontend or backend unless it's global
  5. fill in the template below and delete template comments
  6. review thyself: read the diff and repro the preview as written
  7. open PR & confirm that CI passes
  8. request reviewers, if needed
  9. delete this section before merging

📣 Summary

Add two new endpoints for viewing project history logs, one for all logs, and one for logs for a given project.

📖 Description

Adds two new endpoints: /api/v2/project-history-logs (all project history logs) and /api/v2/assets/<uid>/history (logs for the specific project).
The former is only available to superusers, the latter is available to anyone with the manage_asset permission for the project.
Both endpoints can be searched by a all fields, most importantly action, metadata__asset_uid, and username. A full list of available searchable fields is in the endpoint documentation.

👀 Preview steps

Feature/no-change template:

  1. ℹ️ have two accounts, one super and one not. Have at least two projects.
  2. Change the name of both projects to generate some logs.
  3. Log in as the superuser.
  4. Go to localhost/api/v2/project-history-logs
  5. 🟢 You should see logs for both projects
  6. Grant the non-superuser the manage_project permission for one of the projects (they will have this if they are the owner, or you can assign it from Settings > Sharing)
  7. Log out
  8. 🟢 Go to localhost/api/v2/project-history-logs. You should get a 401.
  9. Log in as the non-superuser.
  10. 🟢 Go to localhost/api/v2/project-history-logs. You should get a 403.
  11. Go to localhost/api/v2/assets/<asset_uid>/history
  12. 🟢 You should see project history logs for just that project
  13. Revoke the manage_project permission for the user. You can do this by transferring ownership or just removing the singular permission (will require you to log back in as the superuser).
  14. 🟢 Reload localhost/api/v2/assets/<asset_uid>/history. You should get a 403.

💭 Notes

@rgraber rgraber force-pushed the rsgraber/TASK-973-create-endpoints branch from 6de52b6 to f9d33e4 Compare December 3, 2024 16:17
@rgraber rgraber added API Changes related to API endpoints Back end labels Dec 3, 2024
@rgraber rgraber marked this pull request as ready for review December 3, 2024 18:23
@rgraber rgraber requested a review from Guitlle December 3, 2024 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Changes related to API endpoints Back end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants