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();
 }
 /**
  * Builds a filter list based on params.
  * @param  array          $params
  * @return App_ListFilter | null
  */
 public function buildFilterList(array $params)
 {
     $factory = new \App_ListFilter_FilterFactory();
     $fields = UserFilterFields::getWhiteList();
     if (!isset($params[UserFilterFields::ORGANIZATION_ID])) {
         $orgs = array(\App::getOrgUserLogged()->id);
         $orgService = OrgService::getInstance();
         if ($childrenType = $orgService->getChildrenTypeByOrg(\App::getOrgUserLogged())) {
             $orgFilter = $orgService->buildFilterList(array('type' => $childrenType, OrgFilterFields::PARENT_ID => \App::getOrgUserLogged()->id));
             $list = $orgService->listAll($childrenType, array('filterList' => $orgFilter, 'count' => 1000));
             foreach ($list->getItems() as $item) {
                 $orgs[] = $item->id;
             }
         }
         $params[UserFilterFields::ORGANIZATION_ID] = '[' . implode(',', $orgs) . ']';
     }
     $factory->setWhiteList($fields);
     $sortingFields = UserSortingFields::getWhiteList();
     $factory->setSortingWhiteList($sortingFields);
     $filterList = $factory->constructFilter($params);
     $filterList->addExtraData('filterType', 'user');
     $filterList->setResourceId(UserFilterFields::getResourceId());
     return $filterList->isValid() ? $filterList : null;
 }