public function testCanGetGroupUsers() { $rows[] = $this->GetGroupUserRow(1, 'f', 'l'); $rows[] = $this->GetGroupUserRow(2, '2f', '2l'); $this->db->SetRow(0, array(array(ColumnNames::TOTAL => 20))); $this->db->SetRow(1, $rows); $groupId = 50; $users = $this->repository->GetUsersInGroup($groupId, 1, 20); $actualCommand = $this->db->_LastCommand; $this->assertEquals(new GetAllGroupUsersCommand($groupId, AccountStatus::ACTIVE), $actualCommand); $results = $users->Results(); $this->assertEquals(2, count($results)); $this->assertEquals(1, $results[0]->Id); }
public function ProcessDataRequest() { $response = ''; $request = $this->page->GetDataRequest(); switch ($request) { case 'groupMembers': $users = $this->groupRepository->GetUsersInGroup($this->page->GetGroupId(), 1, 100); $response = new UserGroupResults($users->Results(), $users->PageInfo()->Total); break; case 'permissions': $response = $this->GetGroupResourcePermissions(); break; case 'roles': $response = $this->GetGroupRoles(); break; } $this->page->SetJsonResponse($response); }
private function GetGroupUsers($groupId) { $groupRepo = new GroupRepository(); $results = $groupRepo->GetUsersInGroup($groupId)->Results(); /** @var $result UserItemView */ foreach ($results as $result) { // consolidates results by user id if the user is in multiple groups $users[$result->Id] = new AutocompleteUser($result->Id, $result->First, $result->Last, $result->Email, $result->Username); } return array_values($users); }