Search in sources :

Example 31 with Group

use of edu.hawaii.its.api.type.Group in project uhgroupings by uhawaii-system-its-ti-iam.

the class TestGroupingAssignmentService method getMembersTest.

@Test
public void getMembersTest() {
    Group group = groupingAssignmentService.getMembers(username[0], GROUPING);
    List<String> usernames = group.getUsernames();
    assertTrue(usernames.contains(username[0]));
    assertTrue(usernames.contains(username[1]));
    assertTrue(usernames.contains(username[2]));
    assertFalse(usernames.contains(username[3]));
    assertTrue(usernames.contains(username[4]));
    assertTrue(usernames.contains(username[5]));
}
Also used : Group(edu.hawaii.its.api.type.Group) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 32 with Group

use of edu.hawaii.its.api.type.Group 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)

Example 33 with Group

use of edu.hawaii.its.api.type.Group 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 34 with Group

use of edu.hawaii.its.api.type.Group 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 35 with Group

use of edu.hawaii.its.api.type.Group 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)

Aggregations

Group (edu.hawaii.its.api.type.Group)40 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)23 Person (edu.hawaii.its.api.type.Person)21 Grouping (edu.hawaii.its.api.type.Grouping)13 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 WsSubjectLookup (edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)9 Before (org.junit.Before)8 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)7 Membership (edu.hawaii.its.api.type.Membership)6 WsGetMembersResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults)4 WsSubject (edu.internet2.middleware.grouperClient.ws.beans.WsSubject)4 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)3 AdminListsHolder (edu.hawaii.its.api.type.AdminListsHolder)2 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)2 WsGetGroupsResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResult)2 WsGetGroupsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResults)2 WsGetMembersResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResult)2 GroupingAssignment (edu.hawaii.its.api.type.GroupingAssignment)1