Search in sources :

Example 1 with WsAssignAttributesResults

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

the class GrouperFactoryServiceTest method makeWsAssignAttributesResultsForGroupLookupVersionTest.

@Test
public void makeWsAssignAttributesResultsForGroupLookupVersionTest() {
    WsAssignAttributesResults results;
    WsSubjectLookup lookup = gfsl.makeWsSubjectLookup(users.get(0).getUsername());
    WsSubjectLookup lookup2 = gfsl.makeWsSubjectLookup(users.get(3).getUsername());
    String assignType = "type";
    String assignOperation = OPERATION_ASSIGN_ATTRIBUTE;
    String removeOperation = OPERATION_REMOVE_ATTRIBUTE;
    String defName = LISTSERV;
    String defName2 = OPT_IN;
    String defName3 = OPT_OUT;
    String groupName = GROUPING_3_PATH;
    results = gfsl.makeWsAssignAttributesResultsForGroup(lookup, assignType, assignOperation, defName, groupName);
    assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
    results = gfsl.makeWsAssignAttributesResultsForGroup(lookup2, assignType, assignOperation, defName, groupName);
    assertTrue(results.getResultMetadata().getResultCode().startsWith("FAILURE"));
}
Also used : WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) WsAssignAttributesResults(edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with WsAssignAttributesResults

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

the class GrouperFactoryServiceTest method makeWsAssignAttributesResultsForGroupTest.

// This test also takes care of setGroupingAttribute(grouping, attributeName, on)
@Test
public void makeWsAssignAttributesResultsForGroupTest() {
    WsAssignAttributesResults results;
    String assignType = "type";
    String assignOperation = OPERATION_ASSIGN_ATTRIBUTE;
    String removeOperation = OPERATION_REMOVE_ATTRIBUTE;
    String defName = LISTSERV;
    String defName2 = OPT_IN;
    String defName3 = OPT_OUT;
    String groupName = GROUPING_3_PATH;
    results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, assignOperation, defName, groupName);
    assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
    results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, assignOperation, defName2, groupName);
    assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
    results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, assignOperation, defName3, groupName);
    assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
    results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, assignOperation, "nothing", groupName);
    assertTrue(results.getResultMetadata().getResultCode().startsWith("FAILURE"));
    results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, removeOperation, defName, groupName);
    assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
}
Also used : WsAssignAttributesResults(edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with WsAssignAttributesResults

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

the class MembershipServiceImpl method updateLastModified.

// updates the last modified attribute of the group to the current date and time
@Override
public GroupingsServiceResult updateLastModified(String groupPath) {
    logger.info("updateLastModified; group: " + groupPath + ";");
    String time = wsDateTime();
    WsAttributeAssignValue dateTimeValue = grouperFS.makeWsAttributeAssignValue(time);
    WsAssignAttributesResults assignAttributesResults = grouperFS.makeWsAssignAttributesResults(ASSIGN_TYPE_GROUP, OPERATION_ASSIGN_ATTRIBUTE, groupPath, YYYYMMDDTHHMM, OPERATION_REPLACE_VALUES, dateTimeValue);
    return hs.makeGroupingsServiceResult(assignAttributesResults, "update last-modified attribute for " + groupPath + " to time " + time);
}
Also used : WsAttributeAssignValue(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssignValue) WsAssignAttributesResults(edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults)

Example 4 with WsAssignAttributesResults

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

the class GrouperFactoryServiceImplLocal method makeWsAssignAttributesResultsForGroup.

@Override
public WsAssignAttributesResults makeWsAssignAttributesResultsForGroup(String attributeAssignType, String attributeAssignOperation, String attributeDefNameName, String ownerGroupName) {
    WsAssignAttributesResults wsAssignAttributesResults = new WsAssignAttributesResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(FAILURE);
    Grouping grouping = groupingRepository.findByPath(ownerGroupName);
    if (attributeAssignOperation.equals(OPERATION_ASSIGN_ATTRIBUTE)) {
        if (setGroupingAttribute(grouping, attributeDefNameName, true)) {
            wsResultMeta.setResultCode(SUCCESS);
        }
    } else if (attributeAssignOperation.equals(OPERATION_REMOVE_ATTRIBUTE)) {
        if (setGroupingAttribute(grouping, attributeDefNameName, false)) {
            wsResultMeta.setResultCode(SUCCESS);
        }
    }
    wsAssignAttributesResults.setResultMetadata(wsResultMeta);
    return wsAssignAttributesResults;
}
Also used : WsAssignAttributesResults(edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Grouping(edu.hawaii.its.api.type.Grouping)

Example 5 with WsAssignAttributesResults

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

the class GrouperFactoryServiceImplLocal method makeWsAssignAttributesResultsForMembership.

@Override
public WsAssignAttributesResults makeWsAssignAttributesResultsForMembership(String attributeAssignType, String attributeAssignOperation, String attributeDefNameName, String ownerMembershipId) {
    WsAssignAttributesResults wsAssignAttributesResults = new WsAssignAttributesResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    wsAssignAttributesResults.setResultMetadata(wsResultMeta);
    Membership membership = membershipRepository.findById(ownerMembershipId);
    if (attributeAssignOperation.equals(OPERATION_ASSIGN_ATTRIBUTE)) {
        membership.setSelfOpted(true);
    } else if (attributeAssignOperation.equals(OPERATION_REMOVE_ATTRIBUTE)) {
        membership.setSelfOpted(false);
    }
    membershipRepository.save(membership);
    return wsAssignAttributesResults;
}
Also used : WsAssignAttributesResults(edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults) Membership(edu.hawaii.its.api.type.Membership) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)

Aggregations

WsAssignAttributesResults (edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults)8 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)4 Grouping (edu.hawaii.its.api.type.Grouping)3 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 Membership (edu.hawaii.its.api.type.Membership)1 Person (edu.hawaii.its.api.type.Person)1 WsAttributeAssignValue (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssignValue)1 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)1 WsSubjectLookup (edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)1