From 21e0e3dc02cc520e37e900a3226d7181f0fc6104 Mon Sep 17 00:00:00 2001 From: saifulislamferoz Date: Thu, 4 Jun 2026 13:05:03 +0600 Subject: [PATCH 1/3] feat: update PHP and Symfony version compatibility --- .github/workflows/ci.yml | 2 +- composer.json | 34 +++++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c892f8..70d282a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: operating-system: [ ubuntu-latest ] - php-versions: [ '8.1', '8.2', '8.3' ] + php-versions: [ '8.1', '8.2', '8.3', '8.4' ] steps: - name: Checkout diff --git a/composer.json b/composer.json index c2c11f1..26387cd 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,17 @@ "name": "xiidea/easy-audit", "type": "symfony-bundle", "description": "A Symfony Bundle To Log Selective Events. It is easy to configure and easy to customize for your need", - "keywords": ["Event Log", "Audit Log", "Symfony2", "Symfony3", "Symfony4", "Symfony5", "Symfony6", "Audit trail", "PSR-3"], + "keywords": [ + "Event Log", + "Audit Log", + "Symfony2", + "Symfony3", + "Symfony4", + "Symfony5", + "Symfony6", + "Audit trail", + "PSR-3" + ], "license": "MIT", "homepage": "http://xiidea.github.io/EasyAuditBundle/", "authors": [ @@ -23,29 +33,31 @@ "require": { "php": ">=8.1", "psr/log": "^1|^2|^3", - "symfony/framework-bundle": ">=5.4 <8.0", - "symfony/security-bundle": ">=5.4 <8.0" + "symfony/framework-bundle": ">=5.4 <9.0", + "symfony/security-bundle": ">=5.4 <9.0" }, "require-dev": { "phpunit/phpunit": "^9.5", "php-coveralls/php-coveralls": "^2.1", "doctrine/common": ">=2.2 <4.0", "symfony/test-pack": "^1.0", - "symfony/twig-bundle": ">=5.4 <8.0", - "symfony/form": ">=5.4 <8.0", - "symfony/validator": ">=5.4 <8.0" + "symfony/twig-bundle": ">=5.4 <9.0", + "symfony/form": ">=5.4 <9.0", + "symfony/validator": ">=5.4 <9.0" }, "autoload": { - "psr-4": { - "Xiidea\\EasyAuditBundle\\": "" - } + "psr-4": { + "Xiidea\\EasyAuditBundle\\": "" + } }, "autoload-dev": { - "psr-4": { "Xiidea\\EasyAuditBundle\\Tests\\": "Tests/" } + "psr-4": { + "Xiidea\\EasyAuditBundle\\Tests\\": "Tests/" + } }, "extra": { "branch-alias": { "dev-master": "3.0.x-dev" } } -} +} \ No newline at end of file From 3e9ade3e1d3c5420f42d3dba1f5aff4fd6a99731 Mon Sep 17 00:00:00 2001 From: saifulislamferoz Date: Thu, 4 Jun 2026 13:05:16 +0600 Subject: [PATCH 2/3] feat: enhance user identification method in UserAwareComponent --- Common/UserAwareComponent.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Common/UserAwareComponent.php b/Common/UserAwareComponent.php index 9a4eb1a..f998503 100644 --- a/Common/UserAwareComponent.php +++ b/Common/UserAwareComponent.php @@ -100,10 +100,12 @@ final protected function getImpersonatingUser() public function getUsername() { $user = $this->getUser(); - if (empty($user)) { return $this->getAnonymousUserName(); } + if (method_exists($user, 'getUserIdentifier')) { + return $user->getUserIdentifier(); + } return $user->getUsername(); } From c4a41710c8457b5f7bb9798061346e866061b56c Mon Sep 17 00:00:00 2001 From: saifulislamferoz Date: Thu, 4 Jun 2026 13:22:24 +0600 Subject: [PATCH 3/3] test: add test for legacy user with only getUsername method --- Tests/Common/UserAwareComponentTest.php | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Tests/Common/UserAwareComponentTest.php b/Tests/Common/UserAwareComponentTest.php index 5b4a6ce..eb73433 100644 --- a/Tests/Common/UserAwareComponentTest.php +++ b/Tests/Common/UserAwareComponentTest.php @@ -102,6 +102,32 @@ public function testShouldReturnImpersonatingUserIfUserHavePreviousAdminRole() $this->assertEquals(1, $user->getId()); } + public function testGetUsernameWithLegacyUserHavingOnlyGetUsername() + { + $legacyUser = new class { + public function getUsername() + { + return 'legacy-user'; + } + }; + + $component = new class($legacyUser) extends DummyUserAwareComponent { + private $mockUser; + + public function __construct($mockUser) + { + $this->mockUser = $mockUser; + } + + public function getUser() + { + return $this->mockUser; + } + }; + + $this->assertEquals('legacy-user', $component->getUsername()); + } + private function mockSecurityAuthChecker($isGranted = false) { $this->authChecker->expects($this->once())