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: Audit Trail #4425

Merged
merged 23 commits into from Oct 30, 2023
Merged

Feature: Audit Trail #4425

merged 23 commits into from Oct 30, 2023

Conversation

nanokatz
Copy link
Contributor

Proposed change

Enables an audit trail for each document,document type, correspondent, and tag. This records all changes made to the documents to meet requirement such as GoDB.
Uses django-auditlog and once enabled cannot be disabled to maintain the log.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other (please explain):

Checklist:

  • I have read & agree with the contributing guidelines.
  • If applicable, I have included testing coverage for new code in this PR, for backend and / or front-end changes.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • If applicable, I have checked that all tests pass, see documentation.
  • I have run all pre-commit hooks, see documentation.
  • I have made corresponding changes to the documentation as needed.
  • I have checked my modifications for any breaking changes.

@nanokatz nanokatz requested a review from a team as a code owner October 22, 2023 15:36
@paperless-ngx-secretary paperless-ngx-secretary bot added backend documentation Improvements or additions to documentation non-trivial Requires approval by several team members labels Oct 22, 2023
@paperless-ngx-secretary
Copy link

Hello @nanokatz,

thank you very much for submitting this PR to us!

This is what will happen next:

  1. My robotic colleagues will check your changes to see if they break anything. You can see the progress below.
  2. Once that is finished, human contributors from paperless-ngx review your changes. Since this is a non-trivial change, a review from at least two contributors is required.
  3. Please improve anything that comes up during the review until your pull request gets approved.
  4. Your pull request will be merged into the dev branch. Changes there will be tested further.
  5. Eventually, changes from you and other contributors will be merged into main and a new release will be made.

Please allow up to 7 days for an initial review. We're all very excited about new pull requests but we only do this as a hobby.
If any action will be required by you, please reply within a month.

Dockerfile Outdated Show resolved Hide resolved
docs/configuration.md Outdated Show resolved Hide resolved
@shamoon shamoon changed the title Audit Trail Feature: Audit Trail Oct 23, 2023
Copy link
Member

@shamoon shamoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this would definitely be a cool feature but besides the things noted (small, mostly), my big concern is that this is in no way surfaced to the frontend. In general, do we want to be adding features that are only visible via the Django interface?

Im not sure it would be so challenging to do, but at the moment this PR is just adding the audit-log dependency. I personally think it wouldn't make sense unless we include a frontend way to use this.

Not sure what others think

docs/configuration.md Outdated Show resolved Hide resolved
src/documents/models.py Show resolved Hide resolved
src/paperless/settings.py Outdated Show resolved Hide resolved
@nanokatz
Copy link
Contributor Author

Thanks, this would definitely be a cool feature but besides the things noted (small, mostly), my big concern is that this is in no way surfaced to the frontend. In general, do we want to be adding features that are only visible via the Django interface?

Im not sure it would be so challenging to do, but at the moment this PR is just adding the audit-log dependency. I personally think it wouldn't make sense unless we include a frontend way to use this.

Not sure what others think

That was an active choice on my side. I wanted there to be a log; and for it to be accesible but in an out of the way place. Turns out it was very easy as you noted. I should add a note to the documentation though that it is only acessible in the django admin otherwise its not clear.
But I would go with what ever people thing is needed. Nothing against adding a frontend for it but I didnt think it nessecary.

@shamoon
Copy link
Member

shamoon commented Oct 23, 2023

Also, every entry shows the user as system, which seems to be a problem
Screenshot 2023-10-22 at 11 04 34 PM

@shamoon shamoon marked this pull request as draft October 23, 2023 06:12
@shamoon shamoon added enhancement New feature and removed documentation Improvements or additions to documentation labels Oct 23, 2023
Copy link
Member

@shamoon shamoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some small notes, I think there are other issues I'll leave to backend

docs/configuration.md Outdated Show resolved Hide resolved
docs/configuration.md Outdated Show resolved Hide resolved
docs/configuration.md Outdated Show resolved Hide resolved
src/paperless/settings.py Outdated Show resolved Hide resolved
nanokatz and others added 3 commits October 24, 2023 06:18
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
.python-version Outdated Show resolved Hide resolved
@stumpylog stumpylog added this to the v2.0.0 milestone Oct 27, 2023
@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

Merging #4425 (5baa201) into dev (f695d4b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##              dev    #4425   +/-   ##
=======================================
  Coverage   95.89%   95.89%           
=======================================
  Files         359      359           
  Lines       13712    13725   +13     
  Branches     1094     1094           
=======================================
+ Hits        13149    13162   +13     
  Misses        559      559           
  Partials        4        4           
Flag Coverage Δ
backend 94.53% <100.00%> (+<0.01%) ⬆️
frontend 97.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/documents/admin.py 98.83% <100.00%> (+0.01%) ⬆️
src/documents/models.py 97.91% <ø> (ø)
src/documents/tasks.py 95.27% <100.00%> (+0.06%) ⬆️
src/documents/views.py 95.40% <ø> (ø)
src/paperless/__init__.py 100.00% <100.00%> (ø)
src/paperless/checks.py 100.00% <100.00%> (ø)
src/paperless/settings.py 89.56% <100.00%> (+0.03%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@stumpylog stumpylog marked this pull request as ready for review October 30, 2023 15:53
Copy link
Member

@shamoon shamoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of business stumpy

@stumpylog stumpylog merged commit 38e035b into paperless-ngx:dev Oct 30, 2023
21 checks passed
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend enhancement New feature non-trivial Requires approval by several team members
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants