/**
  * @NoAdminRequired
  *
  * @param string $pattern
  * @param bool $filterGroups
  * @param int $sortGroups
  * @return DataResponse
  */
 public function index($pattern = '', $filterGroups = false, $sortGroups = MetaData::SORT_USERCOUNT)
 {
     $groupPattern = $filterGroups ? $pattern : '';
     $groupsInfo = new MetaData($this->userSession->getUser()->getUID(), $this->isAdmin, $this->groupManager);
     $groupsInfo->setSorting($sortGroups);
     list($adminGroups, $groups) = $groupsInfo->get($groupPattern, $pattern);
     return new DataResponse(array('data' => array('adminGroups' => $adminGroups, 'groups' => $groups)));
 }
Ejemplo n.º 2
0
 public function testGetWithCache()
 {
     $group = $this->getGroupMock();
     $groups = array_fill(0, 3, $group);
     $this->groupManager->expects($this->once())->method('search')->with('')->will($this->returnValue($groups));
     //two calls, if caching fails call counts for group and groupmanager
     //are exceeded
     $this->groupMetadata->get();
     $this->groupMetadata->get();
 }