public function indexAction() { $templates = array(); // Fetch all users $options = array(); $params = $this->getRequest()->getParams(); $type = $this->_getParam('type'); if (empty($type)) { throw new AppEx\InvalidArgumentException('No template type given'); } if (isset($params['count']) || isset($params['page'])) { $paging = array(); if (isset($params['count'])) { $paging['count'] = $params['count']; unset($params['count']); } if (isset($params['page'])) { $paging['page'] = $params['page']; unset($params['page']); } $options['paging'] = $paging; } $filterList = $this->_templateSrv->buildFilterList($params, \App::getOrgUserLogged()); $this->_helper->filterNotAllowedFilters('filter_by', $filterList); if ($filterList) { $options['filterList'] = $filterList; } $templateList = $this->_templateSrv->listAll($options); $templates = $templateList->getItems(); // Check permissions and remove sensitive information $result = array(); foreach ($templates as $template) { try { $this->_helper->allowed('read', $template); $result[] = $template; } catch (ForbiddenException $e) { // Nothing to do, just skip this user } } $this->view->data = $result; $this->view->count = $templateList->getCount(); }