[UserProvider] audit entry without identifier
Siegii opened this issue · 0 comments
Q | A |
---|---|
auditor-bundle version |
5.2.5 |
PHP version | 8.3.3 |
Database | MySQL |
Summary
We use a public property for the identifier in our user entity and no getId
-method.
The UserProvider.php
creates and returns a new User.php
. It only uses the getId
-method if the $tokenUser
if it is an instance of the symfony UserInterface
.
Current behavior
The bundle currently creates audit entries without the user identifier.
How to reproduce
Use a public property for the id in the user entity and remove the public getter.
Expected behavior
The bundle should create audit entries with the user identifier.
Suggestion:
Isn't it possible that the UserProvider
returns the $tokenUser
if it is already an instance of the DH\Auditor\User\UserInterface
? We put the interface on our user entity. There is no need for the UserProvider
to create a new user.
Example:
UserProvider.php:31
:
if ($tokenUser instanceof AuditorUserInterface) {
return $tokenUser;
}