Search in sources :

Example 6 with WsResultMeta

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

Example 7 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsHasMemberResults.

@Override
public WsHasMemberResults makeWsHasMemberResults(String group, Person person) {
    WsHasMemberResults wsHasMemberResults = new WsHasMemberResults();
    WsHasMemberResult wsHasMemberResult = new WsHasMemberResult();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsHasMemberResult.setResultMetadata(wsResultMeta);
    wsHasMemberResults.setResults(new WsHasMemberResult[] { wsHasMemberResult });
    wsResultMeta.setResultCode("not member");
    Group groupToCheck = groupRepository.findByPath(group);
    // first try username
    if (person.getUsername() != null) {
        person = personRepository.findByUsername(person.getUsername());
        if (groupToCheck.isMember(person)) {
            wsResultMeta.setResultCode(IS_MEMBER);
        }
    // if username is null, try uuid
    } else if (person.getUuid() != null) {
        Person person0 = personRepository.findByUuid(person.getUuid());
        if (groupToCheck.isMember(person0)) {
            wsResultMeta.setResultCode(IS_MEMBER);
        }
    }
    return wsHasMemberResults;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsHasMemberResult(edu.internet2.middleware.grouperClient.ws.beans.WsHasMemberResult) WsHasMemberResults(edu.internet2.middleware.grouperClient.ws.beans.WsHasMemberResults) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Person(edu.hawaii.its.api.type.Person)

Example 8 with WsResultMeta

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

the class HelperServiceTest method makeGroupingsServiceResult.

@Test
public void makeGroupingsServiceResult() {
    String action = "add a member";
    String resultCode = "successfully added member";
    WsAddMemberResults gr = new WsAddMemberResults();
    WsResultMeta resultMeta = new WsResultMeta();
    resultMeta.setResultCode(resultCode);
    gr.setResultMetadata(resultMeta);
    GroupingsServiceResult gsr = helperService.makeGroupingsServiceResult(gr, action);
    assertEquals(action, gsr.getAction());
    assertEquals(resultCode, gsr.getResultCode());
}
Also used : GroupingsServiceResult(edu.hawaii.its.api.type.GroupingsServiceResult) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) WsAddMemberResults(edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 9 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsAssignAttributesResultsForGroup.

@Override
public WsAssignAttributesResults makeWsAssignAttributesResultsForGroup(WsSubjectLookup lookup, String attributeAssignType, String attributeAssignOperation, String attributeDefNameName, String ownerGroupName) {
    WsAssignAttributesResults wsAssignAttributesResults;
    Grouping grouping = groupingRepository.findByPath(ownerGroupName);
    Person person = personRepository.findByUsername(lookup.getSubjectIdentifier());
    if (grouping.getOwners().isMember(person)) {
        wsAssignAttributesResults = makeWsAssignAttributesResultsForGroup(attributeAssignType, attributeAssignOperation, attributeDefNameName, ownerGroupName);
    } else {
        wsAssignAttributesResults = new WsAssignAttributesResults();
        WsResultMeta wsResultMeta = new WsResultMeta();
        wsResultMeta.setResultCode(FAILURE);
        wsAssignAttributesResults.setResultMetadata(wsResultMeta);
    }
    return wsAssignAttributesResults;
}
Also used : WsAssignAttributesResults(edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults) Grouping(edu.hawaii.its.api.type.Grouping) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Person(edu.hawaii.its.api.type.Person)

Example 10 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method addEmptyGroup.

@Override
public WsGroupSaveResults addEmptyGroup(String username, String path) {
    Group newGroup = new Group(path);
    groupRepository.save(newGroup);
    WsGroupSaveResults wsGroupSaveResults = new WsGroupSaveResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    wsGroupSaveResults.setResultMetadata(wsResultMeta);
    return wsGroupSaveResults;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsGroupSaveResults(edu.internet2.middleware.grouperClient.ws.beans.WsGroupSaveResults) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)

Aggregations

WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)16 Group (edu.hawaii.its.api.type.Group)7 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)7 Person (edu.hawaii.its.api.type.Person)6 Grouping (edu.hawaii.its.api.type.Grouping)5 Membership (edu.hawaii.its.api.type.Membership)5 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)5 WsAssignAttributesResults (edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults)4 WsAddMemberResults (edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults)3 WsDeleteMemberResults (edu.internet2.middleware.grouperClient.ws.beans.WsDeleteMemberResults)2 GroupingsServiceResult (edu.hawaii.its.api.type.GroupingsServiceResult)1 WsAssignGrouperPrivilegesLiteResult (edu.internet2.middleware.grouperClient.ws.beans.WsAssignGrouperPrivilegesLiteResult)1 WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)1 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)1 WsGetGrouperPrivilegesLiteResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGrouperPrivilegesLiteResult)1 WsGetMembershipsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults)1 WsGroupSaveResults (edu.internet2.middleware.grouperClient.ws.beans.WsGroupSaveResults)1 WsHasMemberResult (edu.internet2.middleware.grouperClient.ws.beans.WsHasMemberResult)1 WsHasMemberResults (edu.internet2.middleware.grouperClient.ws.beans.WsHasMemberResults)1 WsStemSaveResult (edu.internet2.middleware.grouperClient.ws.beans.WsStemSaveResult)1