use of edu.hawaii.its.api.type.AdminListsHolder in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingAssignmentServiceTest method adminListsTest.
@Test
public void adminListsTest() {
AdminListsHolder adminListsHolder = groupingAssignmentService.adminLists(ADMIN_USER);
AdminListsHolder emptyAdminListHolder = groupingAssignmentService.adminLists(users.get(1).getUsername());
assertEquals(adminListsHolder.getAllGroupings().size(), 5);
assertEquals(adminListsHolder.getAdminGroup().getMembers().size(), 1);
assertEquals(emptyAdminListHolder.getAllGroupings().size(), 0);
assertEquals(emptyAdminListHolder.getAdminGroup().getMembers().size(), 0);
}
use of edu.hawaii.its.api.type.AdminListsHolder in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingAssignmentServiceImpl method adminLists.
// returns an adminLists object containing the list of all admins and all groupings
@Override
public AdminListsHolder adminLists(String adminUsername) {
AdminListsHolder info = new AdminListsHolder();
List<Grouping> groupings;
if (memberAttributeService.isSuperuser(adminUsername)) {
WsGetAttributeAssignmentsResults attributeAssignmentsResults = grouperFS.makeWsGetAttributeAssignmentsResultsTrio(ASSIGN_TYPE_GROUP, TRIO);
List<WsGroup> groups = new ArrayList<>(Arrays.asList(attributeAssignmentsResults.getWsGroups()));
List<String> groupPaths = groups.stream().map(WsGroup::getName).collect(Collectors.toList());
Group admin = getMembers(adminUsername, GROUPING_ADMINS);
groupings = helperService.makeGroupings(groupPaths);
info.setAdminGroup(admin);
info.setAllGroupings(groupings);
}
return info;
}
use of edu.hawaii.its.api.type.AdminListsHolder in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method adminListsPassTest.
@Test
@WithMockUhUser(username = "_groupings_api_2")
public void adminListsPassTest() throws Exception {
AdminListsHolder infoSuccess = mapAdminListsHolder();
// STUDENT_TEST_USERNAME can be replaced with any account that has admin access
assertTrue(infoSuccess.getAdminGroup().getUsernames().contains(STUDENT_TEST_USERNAME));
}
use of edu.hawaii.its.api.type.AdminListsHolder in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method adminListsFailTest.
@Test
@WithMockUhUser(username = "iamtst01")
public void adminListsFailTest() throws Exception {
AdminListsHolder infoFail = mapAdminListsHolder();
assertEquals(infoFail.getAdminGroup().getMembers().size(), 0);
assertEquals(infoFail.getAllGroupings().size(), 0);
}
use of edu.hawaii.its.api.type.AdminListsHolder in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingAssignmentService method adminListsTest.
@Test
public void adminListsTest() {
// try with non-admin
AdminListsHolder info = groupingAssignmentService.adminLists(username[0]);
assertNotNull(info);
assertEquals(info.getAllGroupings().size(), 0);
assertEquals(info.getAdminGroup().getMembers().size(), 0);
assertEquals(info.getAdminGroup().getUsernames().size(), 0);
assertEquals(info.getAdminGroup().getNames().size(), 0);
assertEquals(info.getAdminGroup().getUuids().size(), 0);
}
Aggregations