Skip to content

Commit

Permalink
Merge pull request ezsystems#44 from natanael89/EZP-29144_website_too…
Browse files Browse the repository at this point in the history
…lbar_cache_fix

Fix EZP-29144: Website Toolbar cache doesn't work properly when Owner ( Self ) Policy Limitation is used
  • Loading branch information
andrerom committed Aug 3, 2018
2 parents 0093b2c + af45125 commit 8ef953c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Expand Up @@ -292,6 +292,14 @@ function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $curr
$pageData['website_toolbar'] = ( $currentNodeId && $currentUser->attribute('is_logged_in') );
}

// Get owner_id for easier access in templates
$pageData['owner_id'] = 0;
if ( !empty($currentNodeId) )
{
$node = eZContentObjectTreeNode::fetch( $currentNodeId );
$pageData['owner_id'] = $node->attribute('object')->attribute('owner_id');
}

// Init default menu settings
$pageData['top_menu'] = $menuIni->variable('SelectedMenu', 'TopMenu');
$pageData['left_menu'] = $menuIni->variable('SelectedMenu', 'LeftMenu');
Expand Down
Expand Up @@ -38,7 +38,7 @@
{/foreach}
{/if}

{cache-block keys=array( $module_result.uri, $user_hash, $extra_cache_key )}
{cache-block keys=array( $module_result.uri, $user_hash, $extra_cache_key, $current_user.contentobject_id|eq( $pagedata.owner_id ) )}

<!-- Toolbar area: START -->
{if and( $pagedata.website_toolbar, $pagedata.is_edit|not)}
Expand Down
Expand Up @@ -44,7 +44,7 @@
{include uri='design:page_header.tpl'}
<!-- Header area: END -->

{cache-block keys=array( $module_result.uri, $user_hash, $extra_cache_key )}
{cache-block keys=array( $module_result.uri, $user_hash, $extra_cache_key, $current_user.contentobject_id|eq( $pagedata.owner_id ) )}

<div class="navbar main-navi">
<!-- Top menu area: START -->
Expand Down

0 comments on commit 8ef953c

Please sign in to comment.