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

Added user reference to AccessLog #1122

Closed
wants to merge 1 commit into from

Conversation

Ou7law007
Copy link

This helps identify the logs and trace them to a given user.

Note that the existing username field is modifiable, meaning if changed, the AccessLog can't be traced back to any user.

The username is in AccessBase anyway and not in AccessLog which must be tied to a user.

If there is any chance of this being merged, I'll work further on it, since this will most likely break all previous versions.

AccessLog having a reference to User simply makes sense.

I don't think it's even possible to have a useful AccessLog without an existing User model.

@Ou7law007
Copy link
Author

It's possible to make the user null=True, blank=True, but again it makes sense that every AccessLog must have a user reference with on_delete CASCADE.

The files test_management.py and test_handlers.py would need to be modified. The rest seems fine.

All previous versions would break due to 0009_accesslog_user.py's field=models.ForeignKey(...) not providing a default value.

@codecov
Copy link

codecov bot commented Oct 8, 2023

Codecov Report

Merging #1122 (6ef226e) into master (e781d67) will decrease coverage by 1.53%.
Report is 5 commits behind head on master.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1122      +/-   ##
==========================================
- Coverage   94.63%   93.10%   -1.53%     
==========================================
  Files          34       35       +1     
  Lines        1137     1146       +9     
  Branches      209      209              
==========================================
- Hits         1076     1067       -9     
- Misses         47       65      +18     
  Partials       14       14              
Files Coverage Δ
axes/admin.py 100.00% <100.00%> (ø)
axes/handlers/database.py 94.06% <ø> (-5.94%) ⬇️
axes/migrations/0009_accesslog_user.py 100.00% <100.00%> (ø)
axes/models.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants