Search in sources :

Example 11 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsAssignGrouperPrivilegesLiteResult.

@Override
public WsAssignGrouperPrivilegesLiteResult makeWsAssignGrouperPrivilegesLiteResult(String groupName, String privilegeName, WsSubjectLookup lookup, boolean allowed) {
    WsAssignGrouperPrivilegesLiteResult wsAssignGrouperPrivilegsLiteResult = new WsAssignGrouperPrivilegesLiteResult();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    Person person = personRepository.findByUsername(lookup.getSubjectIdentifier());
    Group group = groupRepository.findByPath(groupName);
    Membership membership = membershipRepository.findByPersonAndGroup(person, group);
    if (privilegeName.equals(PRIVILEGE_OPT_IN)) {
        membership.setOptInEnabled(allowed);
    } else if (privilegeName.equals(PRIVILEGE_OPT_OUT)) {
        membership.setOptOutEnabled(allowed);
    } else {
        throw new IllegalArgumentException("Privilege Name not acceptable");
    }
    wsAssignGrouperPrivilegsLiteResult.setResultMetadata(wsResultMeta);
    return wsAssignGrouperPrivilegsLiteResult;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsAssignGrouperPrivilegesLiteResult(edu.internet2.middleware.grouperClient.ws.beans.WsAssignGrouperPrivilegesLiteResult) Membership(edu.hawaii.its.api.type.Membership) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Person(edu.hawaii.its.api.type.Person)

Example 12 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsGetMembershipsResults.

@Override
public WsGetMembershipsResults makeWsGetMembershipsResults(String groupName, WsSubjectLookup lookup) {
    Person person = personRepository.findByUsername(lookup.getSubjectIdentifier());
    Group group = groupRepository.findByPath(groupName);
    Membership membership = membershipRepository.findByPersonAndGroup(person, group);
    WsGetMembershipsResults wsGetMembershipsResults = new WsGetMembershipsResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(FAILURE);
    WsMembership[] wsMemberships = new WsMembership[1];
    WsMembership wsMembership = new WsMembership();
    if (membership != null) {
        wsMembership.setMembershipId(membership.getId());
        wsResultMeta.setResultCode(SUCCESS);
    }
    wsMemberships[0] = wsMembership;
    wsGetMembershipsResults.setWsMemberships(wsMemberships);
    return wsGetMembershipsResults;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsGetMembershipsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) Membership(edu.hawaii.its.api.type.Membership) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Person(edu.hawaii.its.api.type.Person)

Example 13 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsGetAttributeAssignmentsResultsForMembership.

@Override
public WsGetAttributeAssignmentsResults makeWsGetAttributeAssignmentsResultsForMembership(String assignType, String attributeDefNameName, String membershipId) {
    Membership membership = membershipRepository.findById(membershipId);
    WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults = new WsGetAttributeAssignmentsResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    WsAttributeAssign[] wsAttributeAssigns = new WsAttributeAssign[1];
    WsAttributeAssign wsAttributeAssign = new WsAttributeAssign();
    if (membership.isSelfOpted()) {
        wsAttributeAssign.setAttributeDefNameName(SELF_OPTED);
    }
    wsAttributeAssigns[0] = wsAttributeAssign;
    wsGetAttributeAssignmentsResults.setResultMetadata(wsResultMeta);
    wsGetAttributeAssignmentsResults.setWsAttributeAssigns(wsAttributeAssigns);
    return wsGetAttributeAssignmentsResults;
}
Also used : Membership(edu.hawaii.its.api.type.Membership) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)

Example 14 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsGetGrouperPrivilegesLiteResult.

@Override
public WsGetGrouperPrivilegesLiteResult makeWsGetGrouperPrivilegesLiteResult(String groupName, String privilegeName, WsSubjectLookup lookup) {
    WsGetGrouperPrivilegesLiteResult wsGetGrouperPrivilegesLiteResult = new WsGetGrouperPrivilegesLiteResult();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(FAILURE);
    Person person = personRepository.findByUsername(EVERY_ENTITY);
    Group group = groupRepository.findByPath(groupName);
    Membership membership = membershipRepository.findByPersonAndGroup(person, group);
    boolean enabled = false;
    if (privilegeName.equals(PRIVILEGE_OPT_IN)) {
        if (membership.isOptInEnabled()) {
            enabled = true;
        }
    } else if (privilegeName.equals(PRIVILEGE_OPT_OUT)) {
        if (membership.isOptOutEnabled()) {
            enabled = true;
        }
    } else {
        throw new IllegalArgumentException("Privilege Name not acceptable");
    }
    if (enabled) {
        wsResultMeta.setResultCode(SUCCESS_ALLOWED);
    }
    wsGetGrouperPrivilegesLiteResult.setResultMetadata(wsResultMeta);
    return wsGetGrouperPrivilegesLiteResult;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsGetGrouperPrivilegesLiteResult(edu.internet2.middleware.grouperClient.ws.beans.WsGetGrouperPrivilegesLiteResult) Membership(edu.hawaii.its.api.type.Membership) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Person(edu.hawaii.its.api.type.Person)

Example 15 with WsResultMeta

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

the class GrouperFactoryServiceImplLocal method makeWsAssignAttributesResults.

@Override
public WsAssignAttributesResults makeWsAssignAttributesResults(String attributeAssignType, String attributeAssignOperation, String ownerGroupName, String attributeDefNameName, String attributeAssignValueOperation, WsAttributeAssignValue value) {
    WsAssignAttributesResults wsAssignAttributesResults = new WsAssignAttributesResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    wsAssignAttributesResults.setResultMetadata(wsResultMeta);
    Grouping grouping = groupingRepository.findByPath(ownerGroupName);
    Boolean onOrrOff = null;
    if (attributeAssignOperation.equals(OPERATION_ASSIGN_ATTRIBUTE)) {
        onOrrOff = true;
    } else if (attributeAssignOperation.equals(OPERATION_REMOVE_ATTRIBUTE)) {
        onOrrOff = false;
    }
    if (onOrrOff != null) {
        if (attributeDefNameName.equals(LISTSERV)) {
            grouping.setListservOn(onOrrOff);
        } else if (attributeDefNameName.equals(OPT_IN)) {
            grouping.setOptInOn(onOrrOff);
        } else if (attributeDefNameName.equals(OPT_OUT)) {
            grouping.setOptOutOn(onOrrOff);
        }
    }
    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)

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