Add category ACL check to export conversion to human values

This commit is contained in:
Nathan Gray 2012-11-13 17:40:39 +00:00
parent 464145ee3b
commit fa4ef25f22

View File

@ -365,12 +365,18 @@ class importexport_export_csv implements importexport_iface_export_record
if($record->$name) $record->$name = ExecMethod($method, $record->$name); if($record->$name) $record->$name = ExecMethod($method, $record->$name);
} }
static $cat_object;
if(is_null($cat_object)) $cat_object = new categories(false,$appname);
foreach((array)$fields['select-cat'] as $name) { foreach((array)$fields['select-cat'] as $name) {
if($record->$name) { if($record->$name) {
$cats = array(); $cats = array();
$ids = is_array($record->$name) ? $record->$name : explode(',', $record->$name); $ids = is_array($record->$name) ? $record->$name : explode(',', $record->$name);
foreach($ids as $n => $cat_id) { foreach($ids as $n => $cat_id) {
if ($cat_id) $cats[] = $GLOBALS['egw']->categories->id2name($cat_id);
if ($cat_id && $cat_object->check_perms(EGW_ACL_READ,$cat_id))
{
$cats[] = $cat_object->id2name($cat_id);
}
} }
$record->$name = implode(', ',$cats); $record->$name = implode(', ',$cats);
} }