use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsDeleteMemberResults.
@Override
public WsDeleteMemberResults makeWsDeleteMemberResults(String group, WsSubjectLookup lookup, Person personToDelete) {
WsDeleteMemberResults wsDeleteMemberResults = new WsDeleteMemberResults();
WsResultMeta wsResultMeta = new WsResultMeta();
wsResultMeta.setResultCode(SUCCESS);
wsDeleteMemberResults.setResultMetadata(wsResultMeta);
Grouping grouping = groupingRepository.findByIncludePathOrExcludePathOrCompositePathOrOwnersPath(group, group, group, group);
if (personToDelete.getUsername() != null) {
personToDelete = personRepository.findByUsername(personToDelete.getUsername());
} else if (personToDelete.getUuid() != null) {
personToDelete = personRepository.findByUuid(personToDelete.getUuid());
}
if (grouping == null) {
Group groupToDeleteFrom = groupRepository.findByPath(group);
deleteMember(groupToDeleteFrom, personToDelete);
} else {
if (group.endsWith(OWNERS)) {
deleteMember(grouping.getOwners(), personToDelete);
} else if (group.endsWith(EXCLUDE)) {
deleteMember(grouping.getExclude(), personToDelete);
} else if (group.endsWith(INCLUDE)) {
deleteMember(grouping.getInclude(), personToDelete);
}
grouping = groupingRepository.findByPath(grouping.getPath());
grouping = groupingRepository.findByPath(grouping.getPath());
Group composite = buildComposite(grouping.getInclude(), grouping.getExclude(), grouping.getBasis(), grouping.getPath());
groupRepository.save(composite);
}
return wsDeleteMemberResults;
}
use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method attributeAssignsOptOut.
private List<WsAttributeAssign> attributeAssignsOptOut() {
List<WsAttributeAssign> attributeAssigns = new ArrayList<>();
Iterable<Grouping> groupings = groupingRepository.findAll();
for (Grouping grouping : groupings) {
if (grouping.isOptOutOn()) {
WsAttributeAssign attributeAssign = new WsAttributeAssign();
attributeAssign.setAttributeDefNameName(OPT_OUT);
attributeAssign.setOwnerGroupName(grouping.getPath());
attributeAssigns.add(attributeAssign);
}
}
return attributeAssigns;
}
use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method removeGroupsWithoutOptIn.
private WsGetAttributeAssignmentsResults removeGroupsWithoutOptIn(WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults) {
List<WsGroup> wsGroupList = Arrays.asList(wsGetAttributeAssignmentsResults.getWsGroups());
List<WsGroup> wsGroupsWithOptIn = new ArrayList<>();
List<WsAttributeAssign> wsAttributeAssignList = Arrays.asList(wsGetAttributeAssignmentsResults.getWsAttributeAssigns());
List<WsAttributeAssign> wsAttributeAssignsWithOptIn = new ArrayList<>();
for (WsGroup wsGroup : wsGroupList) {
Grouping grouping = groupingRepository.findByPath(wsGroup.getName());
if (grouping.isOptInOn()) {
wsGroupsWithOptIn.add(wsGroup);
}
}
for (WsAttributeAssign wsAttributeAssign : wsAttributeAssignList) {
Grouping grouping = groupingRepository.findByPath(wsAttributeAssign.getOwnerGroupName());
if (grouping.isOptInOn()) {
wsAttributeAssignsWithOptIn.add(wsAttributeAssign);
}
}
wsGetAttributeAssignmentsResults.setWsAttributeAssigns(wsAttributeAssignsWithOptIn.toArray(new WsAttributeAssign[wsAttributeAssignsWithOptIn.size()]));
wsGetAttributeAssignmentsResults.setWsGroups(wsGroupsWithOptIn.toArray(new WsGroup[wsGroupsWithOptIn.size()]));
return wsGetAttributeAssignmentsResults;
}
use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method grouping.
// Test data.
private Grouping grouping() {
Grouping grouping = new Grouping("test:ing:me:bob");
Group basisGroup = new Group();
basisGroup.addMember(new Person("b0-name", "b0-uuid", "b0-username"));
basisGroup.addMember(new Person("b1-name", "b1-uuid", "b1-username"));
basisGroup.addMember(new Person("b2-name", "b2-uuid", "b2-username"));
grouping.setBasis(basisGroup);
Group exclude = new Group();
exclude.addMember(new Person("e0-name", "e0-uuid", "e0-username"));
grouping.setExclude(exclude);
Group include = new Group();
include.addMember(new Person("i0-name", "i0-uuid", "i0-username"));
include.addMember(new Person("i1-name", "i1-uuid", "i1-username"));
grouping.setInclude(include);
Group owners = new Group();
owners.addMember(new Person("o0-name", "o0-uuid", "o0-username"));
owners.addMember(new Person("o1-name", "o1-uuid", "o1-username"));
owners.addMember(new Person("o2-name", "o2-uuid", "o2-username"));
owners.addMember(new Person("o3-name", "o3-uuid", "o3-username"));
grouping.setOwners(owners);
grouping.setListservOn(true);
return grouping;
}
use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method myGroupings.
// Test data.
private GroupingAssignment myGroupings() {
GroupingAssignment mg = new GroupingAssignment();
List<Grouping> groupings = new ArrayList<>();
for (int i = 0; i < 3; i++) {
groupings.add(grouping());
groupings.get(i).setPath("grouping" + i);
}
mg.setGroupingsIn(groupings);
mg.setGroupingsOwned(groupings);
mg.setGroupingsOptedOutOf(groupings);
mg.setGroupingsOptedInTo(groupings);
mg.setGroupingsToOptOutOf(groupings);
mg.setGroupingsToOptInTo(groupings);
return mg;
}
Aggregations