Commit cc2ba893 authored by kroky6's avatar kroky6

[ENH] pivottable updates: trim data, so it can be grouped more appropriately;...

[ENH] pivottable updates: trim data, so it can be grouped more appropriately; enforce tracker view permission if no field permissions are set
parent ad057e62
......@@ -77,7 +77,7 @@ class Search_Formatter_Plugin_ArrayTemplate implements Search_Formatter_Plugin_I
unset($arguments['format']);
unset($arguments['name']);
unset($arguments['field']);
$entry[str_replace('tracker_field_', '', $field)] = $valueFormatter->$format($field, $arguments);
$entry[str_replace('tracker_field_', '', $field)] = trim($valueFormatter->$format($field, $arguments));
}
return $entry;
}
......
......@@ -153,10 +153,15 @@ function wikiplugin_pivottable($data, $params)
$fields = $definition->getFields();
if( !$perms->admin_trackers ) {
$hasFieldPermissions = false;
foreach( $fields as $key => $field ) {
$isHidden = $field['isHidden'];
$visibleBy = $field['visibleBy'];
if( $isHidden != 'n' || !empty($visibleBy) ) {
$hasFieldPermissions = true;
}
if ($isHidden == 'c') {
// creators can see their own items coming from the search index
} elseif ($isHidden == 'y') {
......@@ -170,6 +175,9 @@ function wikiplugin_pivottable($data, $params)
}
}
}
if( !$hasFieldPermissions && !$perms->view_trackers ) {
return WikiParser_PluginOutput::userError(tr('You do not have rights to view tracker data.'));
}
}
if (!empty($params['rendererName'])) {
......@@ -239,7 +247,7 @@ function wikiplugin_pivottable($data, $params)
} else {
$plugin = new Search_Formatter_Plugin_ArrayTemplate(implode("", array_map(
function($f){
return '{display name="tracker_field_'.$f['permName'].'" default=" "}';
return '{display name="tracker_field_'.$f['permName'].'" default=" "}';
}, $fields)));
$plugin->setFieldPermNames($fields);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment