Skip to content

Commit

Permalink
tweak(Tinebase/Export): ignore acl when fetching user contact for twig
Browse files Browse the repository at this point in the history
  • Loading branch information
pschuele committed Feb 27, 2025
1 parent ba44387 commit d7d3388
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tine20/Tinebase/Export/Abstract.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

/**
* Tinebase Abstract export class
*
* @package Tinebase
* @subpackage Export
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Paul Mehrer <[email protected]>
* @copyright Copyright (c) 2017-2024 Metaways Infosystems GmbH (http://www.metaways.de)
* @copyright Copyright (c) 2017-2025 Metaways Infosystems GmbH (http://www.metaways.de)
*
*/

Expand Down Expand Up @@ -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);
Expand All @@ -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' => [
Expand All @@ -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,
];
Expand Down

0 comments on commit d7d3388

Please sign in to comment.