Search in sources :

Example 1 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsAddMemberResults.

@Override
public WsAddMemberResults makeWsAddMemberResults(String group, WsSubjectLookup lookup, Person personToAdd) {
    Person newGroupMember;
    WsAddMemberResults wsAddMemberResults = new WsAddMemberResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    wsAddMemberResults.setResultMetadata(wsResultMeta);
    Grouping grouping = groupingRepository.findByIncludePathOrExcludePathOrCompositePathOrOwnersPath(group, group, group, group);
    if (personToAdd.getUsername() != null) {
        newGroupMember = personRepository.findByUsername(personToAdd.getUsername());
    } else {
        newGroupMember = personRepository.findByUuid(personToAdd.getUuid());
    }
    if (grouping == null) {
        Group groupToAddTo = groupRepository.findByPath(group);
        addMember(groupToAddTo, newGroupMember);
    } else {
        boolean inBasis = grouping.getBasis().isMember(newGroupMember);
        boolean inExclude = grouping.getExclude().isMember(newGroupMember);
        boolean inInclude = grouping.getInclude().isMember(newGroupMember);
        if (group.endsWith(OWNERS)) {
            addMember(grouping.getOwners(), newGroupMember);
        } else if (group.endsWith(EXCLUDE)) {
            if (inBasis) {
                addMember(grouping.getExclude(), newGroupMember);
            } else if (inInclude) {
                deleteMember(grouping.getInclude(), newGroupMember);
            }
        } else if (group.endsWith(INCLUDE)) {
            if (inExclude) {
                deleteMember(grouping.getExclude(), newGroupMember);
            } else if (!inBasis) {
                addMember(grouping.getInclude(), newGroupMember);
            }
        }
        grouping = groupingRepository.findByPath(grouping.getPath());
        Group composite = buildComposite(grouping.getInclude(), grouping.getExclude(), grouping.getBasis(), grouping.getPath());
        groupRepository.save(composite);
    }
    return wsAddMemberResults;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Grouping(edu.hawaii.its.api.type.Grouping) Person(edu.hawaii.its.api.type.Person) WsAddMemberResults(edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults)

Example 2 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsStemSaveResults.

@Override
public WsStemSaveResults makeWsStemSaveResults(String username, String stemPath) {
    WsStemSaveResults wsStemSaveResults = new WsStemSaveResults();
    WsStemSaveResult wsStemSaveResult = new WsStemSaveResult();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    wsStemSaveResult.setResultMetadata(wsResultMeta);
    wsStemSaveResults.setResultMetadata(wsResultMeta);
    wsStemSaveResults.setResults(new WsStemSaveResult[] { wsStemSaveResult });
    return wsStemSaveResults;
}
Also used : WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) WsStemSaveResults(edu.internet2.middleware.grouperClient.ws.beans.WsStemSaveResults) WsStemSaveResult(edu.internet2.middleware.grouperClient.ws.beans.WsStemSaveResult)

Example 3 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(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 4 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsDeleteMemberResults.

@Override
public WsDeleteMemberResults makeWsDeleteMemberResults(String group, WsSubjectLookup lookup, Person personToDelete) {
    WsDeleteMemberResults wsDeleteMemberResults = new WsDeleteMemberResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    wsDeleteMemberResults.setResultMetadata(wsResultMeta);
    Grouping grouping = groupingRepository.findByIncludePathOrExcludePathOrCompositePathOrOwnersPath(group, group, group, group);
    if (personToDelete.getUsername() != null) {
        personToDelete = personRepository.findByUsername(personToDelete.getUsername());
    } else if (personToDelete.getUuid() != null) {
        personToDelete = personRepository.findByUuid(personToDelete.getUuid());
    }
    if (grouping == null) {
        Group groupToDeleteFrom = groupRepository.findByPath(group);
        deleteMember(groupToDeleteFrom, personToDelete);
    } else {
        if (group.endsWith(OWNERS)) {
            deleteMember(grouping.getOwners(), personToDelete);
        } else if (group.endsWith(EXCLUDE)) {
            deleteMember(grouping.getExclude(), personToDelete);
        } else if (group.endsWith(INCLUDE)) {
            deleteMember(grouping.getInclude(), personToDelete);
        }
        grouping = groupingRepository.findByPath(grouping.getPath());
        grouping = groupingRepository.findByPath(grouping.getPath());
        Group composite = buildComposite(grouping.getInclude(), grouping.getExclude(), grouping.getBasis(), grouping.getPath());
        groupRepository.save(composite);
    }
    return wsDeleteMemberResults;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Grouping(edu.hawaii.its.api.type.Grouping) WsDeleteMemberResults(edu.internet2.middleware.grouperClient.ws.beans.WsDeleteMemberResults)

Example 5 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsAddMemberResults.

@Override
public WsAddMemberResults makeWsAddMemberResults(String group, WsSubjectLookup lookup, List<String> newMembers) {
    WsAddMemberResults wsAddMemberResults = new WsAddMemberResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    for (String username : newMembers) {
        WsResultMeta wsResultMetaData = makeWsAddMemberResults(group, lookup, username).getResultMetadata();
        if (wsResultMetaData.getResultCode().equals(FAILURE)) {
            wsResultMeta = wsResultMetaData;
        }
    }
    wsAddMemberResults.setResultMetadata(wsResultMeta);
    return wsAddMemberResults;
}
Also used : WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) WsAddMemberResults(edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults)

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