-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
Audit user changes #8137
base: main
Are you sure you want to change the base?
Audit user changes #8137
Conversation
9015aa9
to
5691db0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine.
Would this be a better alternative for the metadata versionning (currently stored in metadatastatus)?
… test for UserAuditable
…endency conflict with Geotools for the picocontainer version
d927670
to
73f8e48
Compare
List<String> groupsRegisteredUserList = new ArrayList<>(); | ||
List<String> groupsEditorList = new ArrayList<>(); | ||
List<String> groupsReviewerList = new ArrayList<>(); | ||
List<String> groupsUserAdminList = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm changing this to TreeSet
to get this groups always in the same order.
user = userRepository.save(user); | ||
setUserGroups(user, groups); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed if in line 634 the user was already saved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, removed in 64ff8f5
@@ -615,6 +637,16 @@ public ResponseEntity<String> updateUser( | |||
setUserGroups(user, groups); | |||
} | |||
|
|||
user = userRepository.save(user); | |||
setUserGroups(user, groups); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In lines 636-638 the setUserGroups()
is called conditionally. However, here is being called without any condition always saving the groups even when they shouldn't be saved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, removed in 64ff8f5
This change request allows to audit the changes the users information, using Hibernate Envers.
The feature is disabled by default and can be enabled in the system settings:
Once enabled, changes to users are audited and can be consulted by administrators in the users form or the users access report:
The feature can be extended to support additional types of entities like Groups.
Initially the pull request used Javers, but due to an incompatible version of picocontainer, used also in Geotools, has been changed to Hibernate Envers.
Checklist
main
branch, backports managed with labelREADME.md
filespom.xml
dependency management. Update build documentation with intended library use and library tutorials or documentation