feat(auditlog): Add audit logs for file create/delete#2303
feat(auditlog): Add audit logs for file create/delete#2303sakshamarora1 wants to merge 1 commit intoinveniosoftware:masterfrom
Conversation
5cfa968 to
26512b4
Compare
26512b4 to
c8ab7f4
Compare
| result = super().commit_file(identity, id_, file_key, uow=uow) | ||
|
|
||
| uow.register( | ||
| AuditLogOp(FileCreateAuditLog.build(identity, id_, file_key=file_key)) |
There was a problem hiding this comment.
Why did we choose to use the drafts id for file creation logs and not the parent.pid.pid_value as we do In the other logs?
There was a problem hiding this comment.
For the share access logs, the metadata of the parent is updated. Here, the metadata of the files attached to the record are updated. And through the UI, we can only create or delete a file.
|
|
||
| def __call__(self, data, **kwargs): | ||
| """Update data with file data.""" | ||
| file_key = kwargs.get("file_key", None) |
There was a problem hiding this comment.
nit; the marshmallow schema is required, but here it can possibly be None
| class FileCreateAuditLog(BaseAuditLog): | ||
| """Audit log for file create.""" | ||
|
|
||
| resource_type = "draft" |
There was a problem hiding this comment.
Is this log only for the initial file creation? What if a record is modified and files are added?
There was a problem hiding this comment.
Then it's a new file and a new audit log entry, through the FileService commit_file method
closes: CERNDocumentServer/cds-rdm#681
For files, from what I've observed users can only delete and upload a new file. There aren't any changes done via the service layer on the same file (eg. metadata).
If there is, and maybe I have missed it, please let me know and we can add tracking for that as well.