コード例 #1
0
 public function buildFilterList()
 {
     $filteredParams = $this->_getFilterParams();
     $this->_checkFilterParams($filteredParams, UserFilterFields::getWhiteList());
     $list = $this->_userSrv->buildFilterList($filteredParams);
     $this->_helper->filterNotAllowedFilters('filter_by', $list);
     return $list ? array('filterList' => $list) : array();
 }
コード例 #2
0
 /**
  * Lists all users matching a criteria
  */
 public function indexAction()
 {
     $users = array();
     // Fetch all users
     $options = array();
     $params = $this->getRequest()->getParams();
     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']);
         }
     }
     $filterList = $this->_userSrv->buildFilterList($params);
     $this->_helper->filterNotAllowedFilters('filter_by', $filterList);
     if ($filterList) {
         $options['filterList'] = $filterList;
     }
     $userList = $this->_userSrv->listAll($options, array('paging' => $paging));
     $users = $userList->getItems();
     // Check permissions and remove sensitive information
     $result = array();
     foreach ($users as $user) {
         try {
             $this->_helper->allowed('read', $user);
             $user->setPassword(null);
             $result[] = $user;
         } catch (ForbiddenException $e) {
             $userList->setCount($userList->getCount() - 1);
             // Nothing to do, just skip this user
         }
     }
     $this->view->data = $result;
     $this->view->count = $userList->getCount();
 }