Modx EVO (Evolution) 1.0.9 Block Locked Chunks From End Users

myit web design graphics

Here is a hack fix for Modx EVO (Evolution) 1.0.9 - Block Locked Chunks From End Users 

I edited 2 lines on lines 34 and 39 on [root]/manager/actions/resources.static.php to make the customer just see unlocked chunks.

The condition is: if($row['locked'] == '0' ||  $modx->hasPermission('delete_chunk')) which means: if this chuck is open (unlocked) or the logged in user has permission to delete chunks.

The code becomes:

if ($resourceTable == 'site_plugins') $class = $row['disabled'] ? ' class="disabledPlugin"' : '';
if($row['locked'] == '0' ||  $modx->hasPermission('delete_chunk')){  
$output .= '<li><span'.$class.'><a href="index.php?id='.$row['id'].'&amp;a='.$action.'">'.$row['name'].' <small>(' . $row['id'] . ')</small></a>'.($modx_textdir ? '&rlm;' : '').'</span>';       
$output .= !empty($row['description']) ? ' - '.$row['description'] : '' ;       
$output .= $row['locked'] ? ' <em>('.$_lang['locked'].')</em>' : "" ;       
$output .= '</li>';     
This code still displays chunk group headings. I tested on 2 separate browsers and all chunks are visible and editable to the user with chunk delete permissions e.g. an administrator, and they are not visible to an end user without that delete chunk permission. 

I also disabled the if-block starting at line 180  " if($hasPermission) { " so that the 'combined view' tab wouldn't show the chunks that are not available to the end user in the chunks tab in ELEMENTS--->'MANAGE ELEMENTS'.

This worked for us as the end user wouldn't be deleting chunks, so we disabled that permission in 'security' ---> 'roles'.  If this doesn't work for you, you could check for a particular user-id.