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));
}
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;
}
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);
}
}
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);
}
}
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);
}
}
Aggregations