Catch exception thrown when trying to instanciate a definition the user has no rights for, and discard it.

This commit is contained in:
Nathan Gray 2011-02-10 20:45:32 +00:00
parent 21c1f08322
commit 94c616bf12

View File

@ -438,10 +438,15 @@ class importexport_helper_functions {
$def = new importexport_definitions_bo(array('application'=>$appnames, 'type' => $types));
$list = array();
foreach((array)$def->get_definitions() as $id) {
// Need to instanciate it to check, but if the user doesn't have permission, it throws an exception
try {
$definition = new importexport_definition($id);
if($def->is_permitted($definition->get_record_array())) {
$list[$definition->application][$definition->type] = $id;
}
} catch (Exception $e) {
// That one doesn't work, keep going
}
$definition = null;
}
return $list;