Search in sources :

Example 1 with WsAttributeAssign

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

the class TestGroupingAssignmentService method grouperTest.

@Test
public void grouperTest() {
    List<String> groupPaths = groupingAssignmentService.getGroupPaths(username[0]);
    List<String> groupings = new ArrayList<>();
    List<String> groupings2 = new ArrayList<>();
    if (groupPaths.size() > 0) {
        List<WsAttributeAssign> attributes = new ArrayList<>();
        for (String path : groupPaths) {
            WsGetAttributeAssignmentsResults trioGroups = new GcGetAttributeAssignments().addAttributeDefNameName(TRIO).assignAttributeAssignType(ASSIGN_TYPE_GROUP).addOwnerGroupName(path).execute();
            if (trioGroups.getWsAttributeAssigns() != null) {
                Collections.addAll(attributes, trioGroups.getWsAttributeAssigns());
            }
        }
        if (attributes.size() > 0) {
            groupings.addAll(attributes.stream().map(WsAttributeAssign::getOwnerGroupName).collect(Collectors.toList()));
        }
        assertNotNull(groupings);
        // ////////////////////////////////////////////////////////////////////////////////
        GcGetAttributeAssignments trioGroups2 = new GcGetAttributeAssignments().addAttributeDefNameName(TRIO).assignAttributeAssignType(ASSIGN_TYPE_GROUP);
        groupPaths.forEach(trioGroups2::addOwnerGroupName);
        WsGetAttributeAssignmentsResults attributeAssignmentsResults2 = trioGroups2.execute();
        assertNotNull(attributeAssignmentsResults2);
        WsAttributeAssign[] wsGroups2 = attributeAssignmentsResults2.getWsAttributeAssigns();
        if (wsGroups2 != null && wsGroups2.length > 0) {
            for (WsAttributeAssign grouping : wsGroups2) {
                groupings2.add(grouping.getOwnerGroupName());
            }
        }
    }
    assertNotNull(groupings2);
}
Also used : GcGetAttributeAssignments(edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments) ArrayList(java.util.ArrayList) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with WsAttributeAssign

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

the class MemberAttributeServiceImpl method isSelfOpted.

// return true if the membership between the group and user has the self-opted attribute, false otherwise
@Override
public boolean isSelfOpted(String groupPath, String username) {
    logger.info("isSelfOpted; group: " + groupPath + "; username: " + username + ";");
    if (isMember(groupPath, username)) {
        WsGetMembershipsResults wsGetMembershipsResults = hs.membershipsResults(username, groupPath);
        String membershipID = hs.extractFirstMembershipID(wsGetMembershipsResults);
        WsAttributeAssign[] wsAttributes = getMembershipAttributes(ASSIGN_TYPE_IMMEDIATE_MEMBERSHIP, SELF_OPTED, membershipID);
        for (WsAttributeAssign att : wsAttributes) {
            if (att.getAttributeDefNameName() != null) {
                if (att.getAttributeDefNameName().equals(SELF_OPTED)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : WsGetMembershipsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)

Example 3 with WsAttributeAssign

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

the class MemberAttributeServiceImpl method getMembershipAttributes.

// checks to see if a membership has an attribute of a specific type and returns the list if it does
public WsAttributeAssign[] getMembershipAttributes(String assignType, String attributeUuid, String membershipID) {
    logger.info("getMembershipAttributes; assignType: " + assignType + "; name: " + attributeUuid + "; membershipID: " + membershipID + ";");
    WsGetAttributeAssignmentsResults attributeAssignmentsResults = grouperFS.makeWsGetAttributeAssignmentsResultsForMembership(assignType, attributeUuid, membershipID);
    WsAttributeAssign[] wsAttributes = attributeAssignmentsResults.getWsAttributeAssigns();
    return wsAttributes != null ? wsAttributes : grouperFS.makeEmptyWsAttributeAssignArray();
}
Also used : WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)

Example 4 with WsAttributeAssign

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

the class GrouperFactoryServiceImplLocal method attributeAssignsOptIn.

private List<WsAttributeAssign> attributeAssignsOptIn() {
    List<WsAttributeAssign> attributeAssigns = new ArrayList<>();
    Iterable<Grouping> groupings = groupingRepository.findAll();
    for (Grouping grouping : groupings) {
        if (grouping.isOptInOn()) {
            WsAttributeAssign attributeAssign = new WsAttributeAssign();
            attributeAssign.setAttributeDefNameName(OPT_IN);
            attributeAssign.setOwnerGroupName(grouping.getPath());
            attributeAssigns.add(attributeAssign);
        }
    }
    return attributeAssigns;
}
Also used : ArrayList(java.util.ArrayList) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign) Grouping(edu.hawaii.its.api.type.Grouping)

Example 5 with WsAttributeAssign

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

the class GrouperFactoryServiceImplLocal method attributeAssignsOptOut.

private List<WsAttributeAssign> attributeAssignsOptOut() {
    List<WsAttributeAssign> attributeAssigns = new ArrayList<>();
    Iterable<Grouping> groupings = groupingRepository.findAll();
    for (Grouping grouping : groupings) {
        if (grouping.isOptOutOn()) {
            WsAttributeAssign attributeAssign = new WsAttributeAssign();
            attributeAssign.setAttributeDefNameName(OPT_OUT);
            attributeAssign.setOwnerGroupName(grouping.getPath());
            attributeAssigns.add(attributeAssign);
        }
    }
    return attributeAssigns;
}
Also used : ArrayList(java.util.ArrayList) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign) Grouping(edu.hawaii.its.api.type.Grouping)

Aggregations

WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)11 ArrayList (java.util.ArrayList)8 Grouping (edu.hawaii.its.api.type.Grouping)5 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)5 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)3 WsAttributeDefName (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeDefName)2 AdminListsHolder (edu.hawaii.its.api.type.AdminListsHolder)1 Group (edu.hawaii.its.api.type.Group)1 GroupingAssignment (edu.hawaii.its.api.type.GroupingAssignment)1 Membership (edu.hawaii.its.api.type.Membership)1 Person (edu.hawaii.its.api.type.Person)1 GcGetAttributeAssignments (edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments)1 StemScope (edu.internet2.middleware.grouperClient.ws.StemScope)1 WsGetGroupsResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResult)1 WsGetGroupsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResults)1 WsGetMembersResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults)1 WsGetMembershipsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults)1 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)1 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)1 WsStemLookup (edu.internet2.middleware.grouperClient.ws.beans.WsStemLookup)1