diff --git a/html/controllers/report_builder/enum_templates.php b/html/controllers/report_builder/enum_templates.php index 7768bac2a4..ce258e1210 100644 --- a/html/controllers/report_builder/enum_templates.php +++ b/html/controllers/report_builder/enum_templates.php @@ -1,28 +1,28 @@ getRoles()); - - $returnData['status'] = 'success'; - $returnData['success'] = true; - $returnData['templates'] = $templates; - $returnData['count'] = count($templates); - - \xd_controller\returnJSON($returnData); +try { + $user = \xd_security\getLoggedInUser(); - } - catch (SessionExpiredException $see) { - // TODO: Refactor generic catch block below to handle specific exceptions, - // which would allow this block to be removed. - throw $see; - } - catch (Exception $e) { + $templates = XDReportManager::enumerateReportTemplates($user->getRoles()); - \xd_response\presentError($e->getMessage()); - - } - -?> \ No newline at end of file + // We do not want to show the "Dashboard Tab Reports" + foreach($templates as $key => $value){ + if ($value['name'] === 'Dashboard Tab Report') { + unset($templates[$key]); + } + } + + $returnData['status'] = 'success'; + $returnData['success'] = true; + $returnData['templates'] = $templates; + $returnData['count'] = count($templates); + + \xd_controller\returnJSON($returnData); + +} catch (SessionExpiredException $see) { + // TODO: Refactor generic catch block below to handle specific exceptions, + // which would allow this block to be removed. + throw $see; +} catch (Exception $e) { + \xd_response\presentError($e->getMessage()); +}