Skip to content
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

Migrate admin_audit closure listeners to class listeners #39118

Closed
4 of 8 tasks
ChristophWurst opened this issue Jul 3, 2023 · 1 comment
Closed
4 of 8 tasks

Migrate admin_audit closure listeners to class listeners #39118

ChristophWurst opened this issue Jul 3, 2023 · 1 comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: admin audit performance 🚀 technical debt

Comments

@ChristophWurst
Copy link
Member

⚠️ This issue respects the following points: ⚠️

Bug description

private function securityHooks(IAuditLogger $logger,
EventDispatcherInterface $eventDispatcher): void {
$eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function (GenericEvent $event) use ($logger) {
$security = new Security($logger);
$security->twofactorSuccess($event->getSubject(), $event->getArguments());
});
$eventDispatcher->addListener(IProvider::EVENT_FAILED, function (GenericEvent $event) use ($logger) {
$security = new Security($logger);
$security->twofactorFailed($event->getSubject(), $event->getArguments());
});
}
uses a bunch of closure event listeners. They are heavier than class-based listeners only instantiated when a matching event is emitted.

This will also open the door for unit-testable event listeners.

Steps to reproduce

  1. Look at
    private function securityHooks(IAuditLogger $logger,
    EventDispatcherInterface $eventDispatcher): void {
    $eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function (GenericEvent $event) use ($logger) {
    $security = new Security($logger);
    $security->twofactorSuccess($event->getSubject(), $event->getArguments());
    });
    $eventDispatcher->addListener(IProvider::EVENT_FAILED, function (GenericEvent $event) use ($logger) {
    $security = new Security($logger);
    $security->twofactorFailed($event->getSubject(), $event->getArguments());
    });
    }

Expected behavior

Clean code

Installation method

None

Nextcloud Server version

master

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

cc @luka-nextcloud @blizzz as app maintainers

@ChristophWurst ChristophWurst added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: admin audit technical debt labels Jul 3, 2023
@szaimen szaimen removed the bug label Jul 10, 2023
@joshtrichards joshtrichards changed the title [Performance]: Migrate admin_audit closure listeners to class listeners Migrate admin_audit closure listeners to class listeners Sep 18, 2024
@joshtrichards
Copy link
Member

Gone/fixed now after #47865

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: admin audit performance 🚀 technical debt
Projects
None yet
Development

No branches or pull requests

3 participants