From d7d33888cc0feca36577e55c207d426f991fedba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Sch=C3=BCle?=
Date: Thu, 27 Feb 2025 10:35:52 +0100
Subject: [PATCH] tweak(Tinebase/Export): ignore acl when fetching user contact
for twig
---
tine20/Tinebase/Export/Abstract.php | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/tine20/Tinebase/Export/Abstract.php b/tine20/Tinebase/Export/Abstract.php
index fed4eed4b80..92a3f0eb547 100644
--- a/tine20/Tinebase/Export/Abstract.php
+++ b/tine20/Tinebase/Export/Abstract.php
@@ -1,4 +1,5 @@
- * @copyright Copyright (c) 2017-2024 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright Copyright (c) 2017-2025 Metaways Infosystems GmbH (http://www.metaways.de)
*
*/
@@ -1590,8 +1591,10 @@ protected function _renderTwigTemplate($_record = null)
if (isset($twigResult[$key]) || array_key_exists($key, $twigResult)) {
$value = $this->_convertToString($twigResult[$key]);
} else {
- if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ .
- ' twig mapping: ' . $key . ' ' . $twigKey . ' not found in twig result array');
+ if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
+ Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ .
+ ' twig mapping: ' . $key . ' ' . $twigKey . ' not found in twig result array');
+ }
$value = '';
}
$this->_setValue($twigKey, $value);
@@ -1605,6 +1608,11 @@ protected function _renderTwigTemplate($_record = null)
protected function _getTwigContext(array $context)
{
if (null === $this->_baseContext) {
+ $account = Tinebase_Core::getUser();
+ $contact = Addressbook_Controller_Contact::getInstance()->getContactByUserId(
+ $account->getId(),
+ true);
+
$this->_baseContext = [
Addressbook_Config::INSTALLATION_REPRESENTATIVE => Addressbook_Config::getInstallationRepresentative(),
'branding' => [
@@ -1616,8 +1624,8 @@ protected function _getTwigContext(array $context)
'export' => [
'config' => $this->_config->toArray(),
'timestamp' => $this->_exportTimeStamp,
- 'account' => Tinebase_Core::getUser(),
- 'contact' => Addressbook_Controller_Contact::getInstance()->getContactByUserId(Tinebase_Core::getUser()->getId()),
+ 'account' => $account,
+ 'contact' => $contact,
],
'additionalRecords' => $this->_additionalRecords,
];