Implement audit log on user edit + tests#1730
Merged
evanugarte merged 5 commits intoJul 5, 2025
Merged
Conversation
evanugarte
reviewed
Jul 1, 2025
| userId: decoded._id, // the user making the update | ||
| action: AuditLogActions.UPDATE_USER, | ||
| documentId: user._id, // the user affected by the update | ||
| details: {updatedInfo: user} |
Collaborator
There was a problem hiding this comment.
- edit a user, change their password
- does the password field appear in the AuditLog collection?
- if so, lets add logic to replace password to
true, if it is set, so we avoid storing it
Collaborator
There was a problem hiding this comment.
add a unit test to verify this as well
pxtrickhoxng
force-pushed
the
audit-on-user-update
branch
from
July 1, 2025 04:42
2e7e14d to
85d37fb
Compare
evanugarte
approved these changes
Jul 1, 2025
| await AuditLog.deleteMany({}); | ||
| }); | ||
|
|
||
| it('Should create an audit log when a user is updated', async () => { |
Collaborator
There was a problem hiding this comment.
this could probably be one test? since they both test the same thing except for one extra assertion
evanugarte
approved these changes
Jul 4, 2025
weslayer
approved these changes
Jul 4, 2025
aeiouny
pushed a commit
to aeiouny/Clark
that referenced
this pull request
Jul 7, 2025
* Implement audit log on user edit + tests * update tests to send user data alongside token * ensures user's password isn't stored in audit log * combine unit tests on user edit audit log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an audit log for when a user is updated.