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

[feature] REST API should store revisions with django-reversion #894

Open
nemesifier opened this issue Jul 24, 2024 · 2 comments
Open

[feature] REST API should store revisions with django-reversion #894

nemesifier opened this issue Jul 24, 2024 · 2 comments

Comments

@nemesifier
Copy link
Member

nemesifier commented Jul 24, 2024

Is your feature request related to a problem? Please describe.

It seems to me that changing objects via the REST API, like devices or templates , which in the admin are monitored via django-reversion, doesn't store revisions.

Therefore if a device is changed via the API, there's no way to rollback changes, nor know who changed the object.

Describe the solution you'd like

Ideally, for each model which supports reversion in the admin, we would need to add equivalent features for the REST API:

  • A way to save a revision (and the related user who created the revision) whenever a change is made via PUT/PATCH
  • An endpoint that lists the revisions
  • An endpoint which allows to inspect a revision
  • A way to restore a revision

Describe alternatives you've considered
There may be third party open source tools we can use, otherwise we can add our own logic in openwisp-utils and start rolling this feature out in the main modules.

@okraits
Copy link
Member

okraits commented Aug 12, 2024

A revision should possibly be created if an object is saved by anything but the admin.

https://django-reversion.readthedocs.io/en/latest/api.html#creating-revisions

Additionally it might be need to use follow() when registering a model:

https://django-reversion.readthedocs.io/en/latest/api.html#registration-api

@nemesifier
Copy link
Member Author

nemesifier commented Aug 12, 2024

@okraits reading the issue again, I think I forgot to specify that I meant to convey that this problem happens when modifying objects via the REST API.

@nemesifier nemesifier changed the title [feature] Keep track of changes with django-reversion [feature] REST API should store revisions with django-reversion Aug 12, 2024
@nemesifier nemesifier moved this to To do (general) in OpenWISP Contributor's Board Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To do (general)
Development

No branches or pull requests

2 participants