public function PageLoad() { if ($this->page->GetGroupId() != null) { $groupList = $this->groupRepository->GetList(1, 1, null, null, new SqlFilterEquals(new SqlFilterColumn(TableNames::GROUPS_ALIAS, ColumnNames::GROUP_ID), $this->page->GetGroupId())); } else { $groupList = $this->groupRepository->GetList($this->page->GetPageNumber(), $this->page->GetPageSize()); } $this->page->BindGroups($groupList->Results()); $this->page->BindPageInfo($groupList->PageInfo()); $this->page->BindResources($this->resourceRepository->GetResourceList()); $this->page->BindRoles(array(new RoleDto(1, 'Group Admin', RoleLevel::GROUP_ADMIN), new RoleDto(2, 'Application Admin', RoleLevel::APPLICATION_ADMIN), new RoleDto(3, 'Resource Admin', RoleLevel::RESOURCE_ADMIN), new RoleDto(4, 'Schedule Admin', RoleLevel::SCHEDULE_ADMIN))); $this->page->BindAdminGroups($this->groupRepository->GetGroupsByRole(RoleLevel::GROUP_ADMIN)); }
public function testCanGetListOfGroupsByRole() { $roleLevel = RoleLevel::GROUP_ADMIN; $groupItemRow = new GroupItemRow(); $groupItemRow->With(1, 'g1')->With(2, 'g2'); $rows = $groupItemRow->Rows(); $this->db->SetRow(0, $rows); $getGroupsCommand = new GetAllGroupsByRoleCommand($roleLevel); $groups = $this->repository->GetGroupsByRole($roleLevel); $this->assertEquals(GroupItemView::Create($rows[0]), $groups[0]); $this->assertEquals(GroupItemView::Create($rows[1]), $groups[1]); $this->assertTrue($this->db->ContainsCommand($getGroupsCommand), "missing select group command"); }