From 9d42239eb323588bb9f08a6b12c99e226997103c Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 7 Jul 2026 17:33:37 +0545 Subject: [PATCH 1/5] fix: incompatible AMPF with latest Nextclodu patches Signed-off-by: Saw-jan --- lib/AppInfo/Application.php | 3 ++ lib/Listener/UserLoggedInEventListener.php | 41 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 lib/Listener/UserLoggedInEventListener.php diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 30ce90f87..0313a91cb 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -21,6 +21,7 @@ use OCA\OpenProject\Listener\OpenProjectReferenceListener; use OCA\OpenProject\Listener\TermsOfServiceEventListener; use OCA\OpenProject\Listener\UserChangedListener; +use OCA\OpenProject\Listener\UserLoggedInEventListener; use OCA\OpenProject\Reference\WorkPackageReferenceProvider; use OCA\OpenProject\Search\OpenProjectSearchProvider; use OCA\TermsOfService\Events\SignaturesResetEvent; @@ -46,6 +47,7 @@ use OCP\IUserSession; use OCP\User\Events\BeforeUserDeletedEvent; use OCP\User\Events\UserChangedEvent; +use OCP\User\Events\UserLoggedInEvent; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; @@ -146,6 +148,7 @@ public function boot(IBootContext $context): void { $dispatcher->addServiceListener(BeforeUserDeletedEvent::class, BeforeUserDeletedListener::class); $dispatcher->addServiceListener(BeforeGroupDeletedEvent::class, BeforeGroupDeletedListener::class); $dispatcher->addServiceListener(UserChangedEvent::class, UserChangedListener::class); + $dispatcher->addServiceListener(UserLoggedInEvent::class, UserLoggedInEventListener::class); /** @psalm-suppress InvalidArgument AppEnableEvent event is not in stable25 so making psalm not complain*/ $dispatcher->addServiceListener(AppEnableEvent::class, TermsOfServiceEventListener::class); /** @psalm-suppress InvalidArgument TermsCreatedEvent event is not yet registered in terms_of_service app, so making psalm not complain */ diff --git a/lib/Listener/UserLoggedInEventListener.php b/lib/Listener/UserLoggedInEventListener.php new file mode 100644 index 000000000..554ff4af7 --- /dev/null +++ b/lib/Listener/UserLoggedInEventListener.php @@ -0,0 +1,41 @@ + + */ +class UserLoggedInEventListener implements IEventListener { + public function __construct( + private ISession $session, + private ITimeFactory $timeFactory, + ) { + } + + /** + * @return void + */ + public function handle(Event $event): void { + if (!($event instanceof UserLoggedInEvent)) { + return; + } + + if ($event->getUid() === Application::OPEN_PROJECT_ENTITIES_NAME && $event->isTokenLogin()) { + $this->session->set('last-password-confirm', $this->timeFactory->getTime()); + } + } +} From b7607e51214dd209c4a5d76f67e3a8ae25093673 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 7 Jul 2026 17:36:59 +0545 Subject: [PATCH 2/5] chore: add changelog entry Signed-off-by: Saw-jan --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9242cf75..04bf6a5b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix: Handle invalid boolean auth-method value [#1074](https://github.com/nextcloud/integration_openproject/pull/1074) - Fix: Update OpenProject icon [#1078](https://github.com/nextcloud/integration_openproject/pull/1078) - Fix: False integration setup status even after complete oauth setup [#1086](https://github.com/nextcloud/integration_openproject/pull/1086) +- Fix: Incompatible AMPF with the latest Nextcloud patch releases [#1097](https://github.com/nextcloud/integration_openproject/pull/1097) ## 2.11.3 - 2026-06-18 From 25808259d6ec5f9f184dc53042cdbe15fa1b6f18 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 7 Jul 2026 17:53:07 +0545 Subject: [PATCH 3/5] chore: fix php code format Signed-off-by: Saw-jan --- lib/Listener/UserLoggedInEventListener.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/Listener/UserLoggedInEventListener.php b/lib/Listener/UserLoggedInEventListener.php index 554ff4af7..c8758a159 100644 --- a/lib/Listener/UserLoggedInEventListener.php +++ b/lib/Listener/UserLoggedInEventListener.php @@ -17,16 +17,18 @@ use OCP\User\Events\UserLoggedInEvent; /** - * @template-implements IEventListener + * @template-implements IEventListener */ class UserLoggedInEventListener implements IEventListener { public function __construct( private ISession $session, private ITimeFactory $timeFactory, - ) { + ) { } /** + * @param UserLoggedInEvent $event + * * @return void */ public function handle(Event $event): void { @@ -34,8 +36,10 @@ public function handle(Event $event): void { return; } - if ($event->getUid() === Application::OPEN_PROJECT_ENTITIES_NAME && $event->isTokenLogin()) { - $this->session->set('last-password-confirm', $this->timeFactory->getTime()); - } + if ($event->getUid() === Application::OPEN_PROJECT_ENTITIES_NAME && $event->isTokenLogin()) { + // set the last-password-confirm session variable to allow OpenProject user + // to perform actions using app-password without requiring password confirmation + $this->session->set('last-password-confirm', $this->timeFactory->getTime()); + } } } From 3e3de14f5a8b698c3639c5d0f2d4fb7a5f8c4efd Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Wed, 8 Jul 2026 10:27:49 +0545 Subject: [PATCH 4/5] refactor: move event listener registration inside register method Signed-off-by: Saw-jan --- lib/AppInfo/Application.php | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 0313a91cb..a9a161bd4 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -33,7 +33,6 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\Collaboration\Reference\RenderReferenceEvent; -use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Events\Node\BeforeNodeDeletedEvent; use OCP\Files\Events\Node\BeforeNodeRenamedEvent; use OCP\Group\Events\BeforeGroupDeletedEvent; @@ -119,18 +118,26 @@ public function register(IRegistrationContext $context): void { $context->registerSearchProvider(OpenProjectSearchProvider::class); // register sidebar tab - $context->registerEventListener( - LoadSidebar::class, - LoadSidebarScript::class - ); + $context->registerEventListener(LoadSidebar::class, LoadSidebarScript::class); $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class); - $context->registerEventListener( - BeforeNodeDeletedEvent::class, BeforeNodeInsideOpenProjectGroupfilderChangedListener::class + BeforeNodeDeletedEvent::class, + BeforeNodeInsideOpenProjectGroupfilderChangedListener::class, ); $context->registerEventListener( - BeforeNodeRenamedEvent::class, BeforeNodeInsideOpenProjectGroupfilderChangedListener::class + BeforeNodeRenamedEvent::class, + BeforeNodeInsideOpenProjectGroupfilderChangedListener::class, ); + $context->registerEventListener(BeforeUserDeletedEvent::class, BeforeUserDeletedListener::class); + $context->registerEventListener(BeforeGroupDeletedEvent::class, BeforeGroupDeletedListener::class); + $context->registerEventListener(UserChangedEvent::class, UserChangedListener::class); + $context->registerEventListener(UserLoggedInEvent::class, UserLoggedInEventListener::class); + $context->registerEventListener(AppEnableEvent::class, TermsOfServiceEventListener::class); + + /** @psalm-suppress InvalidArgument */ + $context->registerEventListener(SignaturesResetEvent::class, TermsOfServiceEventListener::class); + /** @psalm-suppress InvalidArgument */ + $context->registerEventListener(TermsCreatedEvent::class, TermsOfServiceEventListener::class); if (version_compare($this->config->getSystemValueString('version', '0.0.0'), '26.0.0', '>=')) { $context->registerReferenceProvider(WorkPackageReferenceProvider::class); @@ -143,18 +150,6 @@ public function register(IRegistrationContext $context): void { public function boot(IBootContext $context): void { $context->injectFn(Closure::fromCallable([$this, 'listenRemoveUserFromGroupRequest'])); $context->injectFn(Closure::fromCallable([$this, 'registerNavigation'])); - /** @var IEventDispatcher $dispatcher */ - $dispatcher = $context->getAppContainer()->get(IEventDispatcher::class); - $dispatcher->addServiceListener(BeforeUserDeletedEvent::class, BeforeUserDeletedListener::class); - $dispatcher->addServiceListener(BeforeGroupDeletedEvent::class, BeforeGroupDeletedListener::class); - $dispatcher->addServiceListener(UserChangedEvent::class, UserChangedListener::class); - $dispatcher->addServiceListener(UserLoggedInEvent::class, UserLoggedInEventListener::class); - /** @psalm-suppress InvalidArgument AppEnableEvent event is not in stable25 so making psalm not complain*/ - $dispatcher->addServiceListener(AppEnableEvent::class, TermsOfServiceEventListener::class); - /** @psalm-suppress InvalidArgument TermsCreatedEvent event is not yet registered in terms_of_service app, so making psalm not complain */ - $dispatcher->addServiceListener(TermsCreatedEvent::class, TermsOfServiceEventListener::class); - /** @psalm-suppress InvalidArgument SignaturesResetEvent event is not yet registered in terms_of_service app, so making psalm not complain*/ - $dispatcher->addServiceListener(SignaturesResetEvent::class, TermsOfServiceEventListener::class); } public function registerNavigation(IUserSession $userSession): void { From ba20c5c5d4d7e3cbf554d588f7ee295620ef8285 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Wed, 8 Jul 2026 10:28:46 +0545 Subject: [PATCH 5/5] test: remove expected failure tag from passing scenarios Signed-off-by: Saw-jan --- tests/acceptance/features/api/teamFolder.feature | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/features/api/teamFolder.feature b/tests/acceptance/features/api/teamFolder.feature index a9fddc85b..21f23b08d 100644 --- a/tests/acceptance/features/api/teamFolder.feature +++ b/tests/acceptance/features/api/teamFolder.feature @@ -50,7 +50,7 @@ Feature: setup the integration through an API When user "Carol" deletes folder "/OpenProject/OpenProject/project-test" Then the HTTP status code should be 204 - @expect-fail + Scenario: check OpenProjectNoAutomaticProjectFolders group after user is removed from OpenProject group (removed by group admin) Given user "Carol" has been created And user "Carol" has been added to the group "OpenProject" @@ -59,7 +59,7 @@ Feature: setup the integration through an API And user "Carol" should belong to group "OpenProjectNoAutomaticProjectFolders" And user "Carol" should not belong to group "OpenProject" - @expect-fail + Scenario: user not in OpenProject group is removed from another group (removed by group admin) Given group "grp1" has been created And user "Carol" has been created @@ -74,7 +74,7 @@ Feature: setup the integration through an API And user "Carol" should belong to group "grp1" And user "Carol" should not belong to group "OpenProjectNoAutomaticProjectFolders" - @expect-fail + Scenario: user not in OpenProject group but has multiple group memberships is removed from one group (removed by group admin) Given group "grp1" has been created And group "grp2" has been created @@ -94,7 +94,7 @@ Feature: setup the integration through an API | Carol | OpenProjectNoAutomaticProjectFolders | And user "Carol" should belong to group "grp2" - @expect-fail + Scenario: user in OpenProject and other groups (removed by group admin) Given group "grp1" has been created And user "Carol" has been created @@ -118,7 +118,7 @@ Feature: setup the integration through an API And user "Carol" should belong to group "OpenProjectNoAutomaticProjectFolders" And user "Carol" should not belong to group "OpenProject" - @expect-fail + Scenario: multiple user in OpenProject groups and only one gets removed (removed by group admin) Given user "Alex" has been created And user "Brian" has been created @@ -137,7 +137,7 @@ Feature: setup the integration through an API | Brian | OpenProjectNoAutomaticProjectFolders | | Carol | OpenProject | - @expect-fail + Scenario: user is in multiple groups including OpenProject and is removed from another group (removed by group admin) Given group "grp1" has been created And user "Carol" has been created