Search in sources :

Example 1 with WsGroup

use of edu.internet2.middleware.grouperClient.ws.beans.WsGroup 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 2 with WsGroup

use of edu.internet2.middleware.grouperClient.ws.beans.WsGroup in project uhgroupings by uhawaii-system-its-ti-iam.

the class GroupingFactoryServiceImpl method getGroupId.

// returns the uid for a group in grouper
private String getGroupId(String groupPath) {
    WsFindGroupsResults results = grouperFactoryService.makeWsFindGroupsResults(groupPath);
    WsGroup result = results.getGroupResults()[0];
    return result.getUuid();
}
Also used : WsFindGroupsResults(edu.internet2.middleware.grouperClient.ws.beans.WsFindGroupsResults) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup)

Example 3 with WsGroup

use of edu.internet2.middleware.grouperClient.ws.beans.WsGroup 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)

Example 4 with WsGroup

use of edu.internet2.middleware.grouperClient.ws.beans.WsGroup in project uhgroupings by uhawaii-system-its-ti-iam.

the class GrouperFactoryServiceImplLocal method removeGroupsWithoutOptIn.

private WsGetAttributeAssignmentsResults removeGroupsWithoutOptIn(WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults) {
    List<WsGroup> wsGroupList = Arrays.asList(wsGetAttributeAssignmentsResults.getWsGroups());
    List<WsGroup> wsGroupsWithOptIn = new ArrayList<>();
    List<WsAttributeAssign> wsAttributeAssignList = Arrays.asList(wsGetAttributeAssignmentsResults.getWsAttributeAssigns());
    List<WsAttributeAssign> wsAttributeAssignsWithOptIn = new ArrayList<>();
    for (WsGroup wsGroup : wsGroupList) {
        Grouping grouping = groupingRepository.findByPath(wsGroup.getName());
        if (grouping.isOptInOn()) {
            wsGroupsWithOptIn.add(wsGroup);
        }
    }
    for (WsAttributeAssign wsAttributeAssign : wsAttributeAssignList) {
        Grouping grouping = groupingRepository.findByPath(wsAttributeAssign.getOwnerGroupName());
        if (grouping.isOptInOn()) {
            wsAttributeAssignsWithOptIn.add(wsAttributeAssign);
        }
    }
    wsGetAttributeAssignmentsResults.setWsAttributeAssigns(wsAttributeAssignsWithOptIn.toArray(new WsAttributeAssign[wsAttributeAssignsWithOptIn.size()]));
    wsGetAttributeAssignmentsResults.setWsGroups(wsGroupsWithOptIn.toArray(new WsGroup[wsGroupsWithOptIn.size()]));
    return wsGetAttributeAssignmentsResults;
}
Also used : ArrayList(java.util.ArrayList) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign) Grouping(edu.hawaii.its.api.type.Grouping)

Example 5 with WsGroup

use of edu.internet2.middleware.grouperClient.ws.beans.WsGroup in project uhgroupings by uhawaii-system-its-ti-iam.

the class GrouperFactoryServiceImpl method addCompositeGroup.

@Override
public WsGroupSaveResults addCompositeGroup(String username, String parentGroupPath, String compositeType, String leftGroupPath, String rightGroupPath) {
    WsGroupToSave groupToSave = new WsGroupToSave();
    WsGroup group = new WsGroup();
    WsGroupDetail wsGroupDetail = new WsGroupDetail();
    // get the left and right groups from the database/grouper
    WsGroup leftGroup = makeWsFindGroupsResults(leftGroupPath).getGroupResults()[0];
    WsGroup rightGroup = makeWsFindGroupsResults(rightGroupPath).getGroupResults()[0];
    wsGroupDetail.setCompositeType(compositeType);
    wsGroupDetail.setLeftGroup(leftGroup);
    wsGroupDetail.setRightGroup(rightGroup);
    group.setName(parentGroupPath);
    group.setDetail(wsGroupDetail);
    groupToSave.setWsGroup(group);
    WsSubjectLookup lookup = makeWsSubjectLookup(username);
    return new GcGroupSave().addGroupToSave(groupToSave).assignActAsSubject(lookup).execute();
}
Also used : WsGroupDetail(edu.internet2.middleware.grouperClient.ws.beans.WsGroupDetail) WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) GcGroupSave(edu.internet2.middleware.grouperClient.api.GcGroupSave) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) WsGroupToSave(edu.internet2.middleware.grouperClient.ws.beans.WsGroupToSave)

Aggregations

WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)20 ArrayList (java.util.ArrayList)9 WsGetGroupsResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResult)5 GroupsException (org.apereo.portal.groups.GroupsException)5 IEntityGroup (org.apereo.portal.groups.IEntityGroup)5 WsFindGroupsResults (edu.internet2.middleware.grouperClient.ws.beans.WsFindGroupsResults)4 Grouping (edu.hawaii.its.api.type.Grouping)3 GcFindGroups (edu.internet2.middleware.grouperClient.api.GcFindGroups)3 GcGroupSave (edu.internet2.middleware.grouperClient.api.GcGroupSave)3 WsGetGroupsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResults)3 WsGroupToSave (edu.internet2.middleware.grouperClient.ws.beans.WsGroupToSave)3 WsSubjectLookup (edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)3 lombok.val (lombok.val)3 Test (org.junit.jupiter.api.Test)3 Group (edu.hawaii.its.api.type.Group)2 WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)2 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)2 WsGroupLookup (edu.internet2.middleware.grouperClient.ws.beans.WsGroupLookup)2 WsQueryFilter (edu.internet2.middleware.grouperClient.ws.beans.WsQueryFilter)2 WsStemLookup (edu.internet2.middleware.grouperClient.ws.beans.WsStemLookup)2