From bf940f95231d82eb72c2ed0dee8014c3bb254f6a Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 30 Apr 2023 18:04:35 +0200 Subject: [PATCH] app/library/Auth.php: Adding getImpersonator() --- app/library/Auth.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/library/Auth.php b/app/library/Auth.php index 7d343cb..80ea7bd 100644 --- a/app/library/Auth.php +++ b/app/library/Auth.php @@ -87,6 +87,12 @@ class Auth extends Injectable $this->eventsManager->fire('auth:onLogin', $this, 'System'); } + public function getImpersonator() + { + $id = $this->session->get(self::IMPERSONATOR_ID); + return $id !== null ? User::findFirst($id) : null; + } + /** * Impersonate a user *