Search in sources :

Example 21 with Person

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

the class HelperServiceTest method setup.

@Before
public void setup() {
    new DatabaseSetup(personRepository, groupRepository, groupingRepository, membershipRepository);
    admins.add(ADMIN_PERSON);
    Group adminGroup = new Group(GROUPING_ADMINS, admins);
    personRepository.save(ADMIN_PERSON);
    groupRepository.save(adminGroup);
    admins.add(APP_PERSON);
    Group appGroup = new Group(GROUPING_APPS, apps);
    personRepository.save(APP_PERSON);
    groupRepository.save(appGroup);
    for (int i = 0; i < 100; i++) {
        String name = NAME + i;
        String uuid = UUID + i;
        String username = USERNAME + i;
        Person person = new Person(name, uuid, username);
        users.add(person);
        WsSubjectLookup lookup = new WsSubjectLookup(null, null, username);
        lookups.add(lookup);
    }
}
Also used : Group(edu.hawaii.its.api.type.Group) WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) Person(edu.hawaii.its.api.type.Person) Before(org.junit.Before)

Example 22 with Person

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

the class MemberAttributeServiceTest method setup.

@Before
public void setup() {
    new DatabaseSetup(personRepository, groupRepository, groupingRepository, membershipRepository);
    admins.add(ADMIN_PERSON);
    Group adminGroup = new Group(GROUPING_ADMINS, admins);
    personRepository.save(ADMIN_PERSON);
    groupRepository.save(adminGroup);
    admins.add(APP_PERSON);
    Group appGroup = new Group(GROUPING_APPS, apps);
    personRepository.save(APP_PERSON);
    groupRepository.save(appGroup);
    for (int i = 0; i < 100; i++) {
        String name = NAME + i;
        String uuid = UUID + i;
        String username = USERNAME + i;
        Person person = new Person(name, uuid, username);
        users.add(person);
        WsSubjectLookup lookup = new WsSubjectLookup(null, null, username);
        lookups.add(lookup);
    }
}
Also used : Group(edu.hawaii.its.api.type.Group) WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) Person(edu.hawaii.its.api.type.Person) Before(org.junit.Before)

Example 23 with Person

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

the class MembershipServiceTest method addMembersByUuid.

@Test
public void addMembersByUuid() {
    // add all uuids
    List<String> uuids = new ArrayList<>();
    for (Person user : users) {
        uuids.add(user.getUuid());
    }
    Grouping grouping = groupingRepository.findByPath(GROUPING_3_PATH);
    // check how many members are in the basis
    int numberOfBasisMembers = grouping.getBasis().getMembers().size();
    // try to put all users into exclude group
    membershipService.addGroupMembersByUuid(users.get(0).getUsername(), GROUPING_3_EXCLUDE_PATH, uuids);
    grouping = groupingRepository.findByPath(GROUPING_3_PATH);
    // there should be no real members in composite, but it should still have the 'grouperAll' member
    assertEquals(1, grouping.getComposite().getMembers().size());
    // only the users in the basis should have been added to the exclude group
    assertEquals(numberOfBasisMembers, grouping.getExclude().getMembers().size());
    // try to put all users into the include group
    membershipService.addGroupMembersByUuid(users.get(0).getUsername(), GROUPING_3_INCLUDE_PATH, uuids);
    grouping = groupingRepository.findByPath(GROUPING_3_PATH);
    // all members should be in the group ( - 1 for 'grouperAll' in composite);
    assertEquals(uuids.size(), grouping.getComposite().getMembers().size() - 1);
    // members in basis should not have been added to the include group ( + 2 for 'grouperAll' in both groups)
    assertEquals(uuids.size() - numberOfBasisMembers + 2, grouping.getInclude().getMembers().size());
}
Also used : ArrayList(java.util.ArrayList) Grouping(edu.hawaii.its.api.type.Grouping) Person(edu.hawaii.its.api.type.Person) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 24 with Person

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

the class MembershipServiceTest method setup.

@Before
public void setup() {
    new DatabaseSetup(personRepository, groupRepository, groupingRepository, membershipRepository);
    admins.add(ADMIN_PERSON);
    adminGroup = new Group(GROUPING_ADMINS, admins);
    personRepository.save(ADMIN_PERSON);
    groupRepository.save(adminGroup);
    admins.add(APP_PERSON);
    appGroup = new Group(GROUPING_APPS, apps);
    personRepository.save(APP_PERSON);
    groupRepository.save(appGroup);
    for (int i = 0; i < 100; i++) {
        String name = NAME + i;
        String uuid = UUID + i;
        String username = USERNAME + i;
        Person person = new Person(name, uuid, username);
        users.add(person);
        WsSubjectLookup lookup = new WsSubjectLookup(null, null, username);
        lookups.add(lookup);
    }
}
Also used : Group(edu.hawaii.its.api.type.Group) WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) Person(edu.hawaii.its.api.type.Person) Before(org.junit.Before)

Example 25 with Person

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

Aggregations

Person (edu.hawaii.its.api.type.Person)32 Group (edu.hawaii.its.api.type.Group)20 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)9 WsSubjectLookup (edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)8 Before (org.junit.Before)8 Grouping (edu.hawaii.its.api.type.Grouping)7 ArrayList (java.util.ArrayList)7 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)6 Test (org.junit.Test)6 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 Membership (edu.hawaii.its.api.type.Membership)5 GroupingsServiceResult (edu.hawaii.its.api.type.GroupingsServiceResult)3 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)3 WsSubject (edu.internet2.middleware.grouperClient.ws.beans.WsSubject)2 GroupingsServiceResultException (edu.hawaii.its.api.type.GroupingsServiceResultException)1 WsAddMemberResults (edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults)1 WsAssignAttributesResults (edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults)1 WsAssignGrouperPrivilegesLiteResult (edu.internet2.middleware.grouperClient.ws.beans.WsAssignGrouperPrivilegesLiteResult)1 WsDeleteMemberResults (edu.internet2.middleware.grouperClient.ws.beans.WsDeleteMemberResults)1 WsGetGrouperPrivilegesLiteResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGrouperPrivilegesLiteResult)1