Skip to content

Commit

Permalink
Fix EZP-29144: Website Toolbar cache doesn't work properly when Owner…
Browse files Browse the repository at this point in the history
…( Self ) Policy Limitation is used
  • Loading branch information
jacek-foremski committed Jun 12, 2018
1 parent 0093b2c commit af45125
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 af45125

Please sign in to comment.