Search in sources :

Example 11 with Group

use of edu.hawaii.its.api.type.Group in project uhgroupings by uhawaii-system-its-ti-iam.

the class GrouperFactoryServiceImplLocal method buildComposite.

// //////////////////////////////////////////////////////////////////////////////
// Helper methods
// //////////////////////////////////////////////////////////////////////////////
private Group buildComposite(Group include, Group exclude, Group basis, String path) {
    Group basisMinusExclude = removeExcludedMembers(basis, exclude);
    Group compositeGroup = addIncludedMembers(include, basisMinusExclude);
    compositeGroup.setPath(path);
    return compositeGroup;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group)

Example 12 with Group

use of edu.hawaii.its.api.type.Group 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;
}
Also used : AdminListsHolder(edu.hawaii.its.api.type.AdminListsHolder) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) ArrayList(java.util.ArrayList) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) Grouping(edu.hawaii.its.api.type.Grouping) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup)

Example 13 with Group

use of edu.hawaii.its.api.type.Group in project uhgroupings by uhawaii-system-its-ti-iam.

the class GrouperFactoryServiceImplLocal method addIncludedMembers.

private Group addIncludedMembers(Group include, Group basis) {
    Group unionGroup = new Group();
    List<Person> unionList = new ArrayList<>();
    unionList.addAll(include.getMembers());
    unionList.addAll(basis.getMembers());
    // remove duplicates
    Set<Person> s = new TreeSet<>();
    s.addAll(unionList);
    unionGroup.setMembers(Arrays.asList(s.toArray(new Person[s.size()])));
    return unionGroup;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) Person(edu.hawaii.its.api.type.Person)

Example 14 with Group

use of edu.hawaii.its.api.type.Group in project uhgroupings by uhawaii-system-its-ti-iam.

the class GrouperFactoryServiceImplLocal method removeExcludedMembers.

private Group removeExcludedMembers(Group basisPlusInclude, Group exclude) {
    Group basisPlusIncludeMinusExcludeGroup = new Group();
    ArrayList<Person> newBasisPlusInclude = new ArrayList<>();
    newBasisPlusInclude.addAll(basisPlusInclude.getMembers());
    newBasisPlusInclude.removeAll(exclude.getMembers());
    basisPlusIncludeMinusExcludeGroup.setMembers(newBasisPlusInclude);
    return basisPlusIncludeMinusExcludeGroup;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) ArrayList(java.util.ArrayList) Person(edu.hawaii.its.api.type.Person)

Example 15 with Group

use of edu.hawaii.its.api.type.Group in project uhgroupings by uhawaii-system-its-ti-iam.

the class GrouperFactoryServiceImplLocal method makeWsGetGroupsResults.

@Override
public WsGetGroupsResults makeWsGetGroupsResults(String username, WsStemLookup stemLookup, StemScope stemScope) {
    WsGetGroupsResults wsGetGroupsResults = new WsGetGroupsResults();
    WsGetGroupsResult wsGetGroupsResult = new WsGetGroupsResult();
    WsGroup[] groups;
    List<WsGroup> wsGroupList = new ArrayList<>();
    List<Group> groupList = groupRepository.findByMembersUsername(username);
    for (Group group : groupList) {
        WsGroup g = new WsGroup();
        g.setName(group.getPath());
        wsGroupList.add(g);
    }
    groups = wsGroupList.toArray(new WsGroup[wsGroupList.size()]);
    wsGetGroupsResult.setWsGroups(groups);
    wsGetGroupsResults.setResults(new WsGetGroupsResult[] { wsGetGroupsResult });
    return wsGetGroupsResults;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsGetGroupsResult(edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResult) WsGetGroupsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResults) ArrayList(java.util.ArrayList) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup)

Aggregations

Group (edu.hawaii.its.api.type.Group)40 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)23 Person (edu.hawaii.its.api.type.Person)21 Grouping (edu.hawaii.its.api.type.Grouping)13 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 WsSubjectLookup (edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)9 Before (org.junit.Before)8 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)7 Membership (edu.hawaii.its.api.type.Membership)6 WsGetMembersResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults)4 WsSubject (edu.internet2.middleware.grouperClient.ws.beans.WsSubject)4 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)3 AdminListsHolder (edu.hawaii.its.api.type.AdminListsHolder)2 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)2 WsGetGroupsResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResult)2 WsGetGroupsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResults)2 WsGetMembersResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResult)2 GroupingAssignment (edu.hawaii.its.api.type.GroupingAssignment)1