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

Add custom data and actor email #603

Closed
wants to merge 3 commits into from

Conversation

hamedsh
Copy link
Contributor

@hamedsh hamedsh commented Jan 26, 2024

add actor_email

deleting a user from the Users table will make actor_id useless (its only a bunch of characters). by adding email as static content, it can be usable forever.

adding custom_data

most of the time, data change is not the only thing you need. for example in a real environment with a bunch of CLI actions and Crons, you need some additional records to specify the task that causes the change. by using custom_data, its possible to attach any data to the history log.
example:

with set_auditlog_custom_data(custom_data={"type": "management_command", "command": "clear_unused_records")}):
    target_function(obj)

hamedsh and others added 3 commits January 25, 2024 12:42
In this update, the 'custom_data' field was added to the auditlog. It was incorporated into various sections of the admin, context, migrations, models and tests files, allowing it to be read-only in the auditlog's Admin interface, and allowing for custom data to be logged with log entries. It also includes a migration addition to account for the added field in the LogEntry model. This enhancement provides more flexibility and versatility for tracking auditlog data.
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1ce39c0) 95.20% compared to head (6f0f9af) 95.33%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #603      +/-   ##
==========================================
+ Coverage   95.20%   95.33%   +0.13%     
==========================================
  Files          31       33       +2     
  Lines        1022     1051      +29     
==========================================
+ Hits          973     1002      +29     
  Misses         49       49              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hramezani
Copy link
Member

Thanks @hamedsh for this PR

The change for adding email filed is good.

The LogEntry model has an additional_data field and It can be used to provide additional data for the log record.
It has not been documented yet and we have an issue for documenting this field. probably you can create a PR for that.

@hamedsh please close this PR and create a PR for the actor email.
If you want to make more changes please create separate PR for them.

@hamedsh hamedsh closed this Mar 5, 2024
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