Search in sources :

Example 1 with Person

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

the class DatabaseSetup method makePerson.

// /////////////////////////////////////////////////////////
// factory methods
// /////////////////////////////////////////////////////////
// todo put strings in a config file
private void makePerson(String name, String uuid, String username) {
    Map<String, String> attributes = new HashMap<>();
    attributes.put("cn", name);
    attributes.put("uuid", uuid);
    attributes.put("uid", username);
    persons.add(new Person(attributes));
}
Also used : Person(edu.hawaii.its.api.type.Person)

Example 2 with Person

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

the class DatabaseSetup method removeExcludedMembers.

private Group removeExcludedMembers(Group basisPlusInclude, Group exclude) {
    List<Person> newBasisPlusInclude = new ArrayList<>(basisPlusInclude.getMembers());
    newBasisPlusInclude.removeAll(exclude.getMembers());
    Group basisPlusIncludeMinusExcludeGroup = new Group();
    basisPlusIncludeMinusExcludeGroup.setMembers(newBasisPlusInclude);
    return basisPlusIncludeMinusExcludeGroup;
}
Also used : Group(edu.hawaii.its.api.type.Group) Person(edu.hawaii.its.api.type.Person)

Example 3 with Person

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

the class DatabaseSetup method setUpMemberships.

private void setUpMemberships() {
    Person grouperAll = new Person();
    grouperAll.setUsername("GrouperAll");
    personRepository.save(grouperAll);
    Iterable<Group> groups = groupRepository.findAll();
    for (Group group : groups) {
        group.addMember(grouperAll);
        groupRepository.save(group);
        for (Person person : group.getMembers()) {
            Membership membership = new Membership(person, group);
            membershipRepository.save(membership);
        }
    }
    Iterable<Grouping> groupings = groupingRepository.findAll();
    for (Grouping grouping : groupings) {
        Membership allExclude = membershipRepository.findByPersonAndGroup(grouperAll, grouping.getExclude());
        Membership allInclude = membershipRepository.findByPersonAndGroup(grouperAll, grouping.getInclude());
        Membership allComposite = membershipRepository.findByPersonAndGroup(grouperAll, grouping.getComposite());
        if (grouping.isOptOutOn()) {
            allComposite.setOptOutEnabled(true);
            allExclude.setOptInEnabled(true);
            allExclude.setOptOutEnabled(true);
        }
        if (grouping.isOptInOn()) {
            allComposite.setOptInEnabled(true);
            allInclude.setOptInEnabled(true);
            allInclude.setOptOutEnabled(true);
        }
        membershipRepository.save(allComposite);
        membershipRepository.save(allExclude);
        membershipRepository.save(allInclude);
    }
}
Also used : Group(edu.hawaii.its.api.type.Group) Membership(edu.hawaii.its.api.type.Membership) Grouping(edu.hawaii.its.api.type.Grouping) Person(edu.hawaii.its.api.type.Person)

Example 4 with Person

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

the class GroupAttributeServiceTest 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 5 with Person

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

the class GroupingAssignmentServiceTest 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 : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) 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)

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